Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8099215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:19:58+00:00 2026-06-05T22:19:58+00:00

I am developing an app that has java files and php files. The java

  • 0

I am developing an app that has java files and php files. The java files call to the php files, these execute queries in the ddbb and return the result as an array php, but printing it in the screen. I take this in java like an string, and I have to convert it to and array or collection, but I have no idea how to do it.

An example of the result that php prints is:

Array
(
[0] => Array
    (
        [id] => 1
        [0] => 1
        [name] => pepe
        [1] => pepe
    )

[1] => Array
    (
        [id] => 2
        [0] => 2
        [name] => antoñito
        [1] => antoñito
    )

[2] => Array
    (
        [id] => 3
        [0] => 3
        [name] => loló
        [1] => loló
    )

[3] => Array
    (
        [id] => 4
        [0] => 4
        [name] => ñoño
        [1] => ñoño
    )

[4] => Array
    (
        [id] => 5
        [0] => 5
        [name] => Antoñito
        [1] => Antoñito
    )

[5] => Array
    (
        [id] => 7
        [0] => 7
        [name] => José
        [1] => José
    )

)

If I use json_encode($the_array) this is the result:

[{"id":"1","0":"1","name":"pepe","1":"pepe"},    {"id":"2","0":"2","name":"anto\u00f1ito","1":"anto\u00f1ito"},{"id":"3","0":"3","name":"lol\u00f3","1":"lol\u00f3"},{"id":"4","0":"4","name":"\u00f1o\u00f1o","1":"\u00f1o\u00f1o"},{"id":"5","0":"5","name":"Anto\u00f1ito","1":"Anto\u00f1ito"},{"id":"7","0":"7","name":"Jos\u00e9","1":"Jos\u00e9"}]

Thanks everyone

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:20:00+00:00Added an answer on June 5, 2026 at 10:20 pm

    You should select a serialization method for your data. For e.g. XML, Protocol Buffers, or JSON.

    I recommend you use JSON because it’s lightweight, easy to read even for humans and there are broad libraries available for both languages.

    Encoding on the PHP side

    $encoded = json_encode($data);
    

    Decoding on the Java side with Jackson

    final ObjectMapper objectMapper = new ObjectMapper();
    // The better way is to create a custom class with the correct format
    final Map<?, ?> decoded = objectMapper.readValue(encoded, Map.class);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an app under Java that has to call at some point
I'm developing an iPhone app that has a network component. I'm developing the app
I'm developing an app that has a few services, which communicate using AIDL. In
I'm developing a web app that has a database backend. In the past I'm
I'm developing an app that checks several conditions during an incoming phone call. The
I am developing app that has multiple skins and I have a dilemma on
I am developing a Java application using Google App Engine that depends on a
I've been developing my first Java EE app, which has a number of JPA
I'm developing an app that has a feature to search a text ( searchString
Ok, so I'm developing a web app that has begun to be more ajaxified.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.