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 7671883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:09:33+00:00 2026-05-31T16:09:33+00:00

For development of web services, i have to make multilevel Associative array as follows

  • 0

For development of web services, i have to make multilevel Associative array as follows

Array
(
    [0] => Array
        (
            [id] => 1100
            [content] => This is content
            [creator_info] => Array
                (
                    [id] => 1
                    [fname] => abc
                    [lname] => xyz
                )

            [tag_info] => Array
                (
                    [0] => Array
                        (
                            [id] => 3
                            [name] => my
                        )

                    [1] => Array
                        (
                            [id] => 4
                            [name] => you
                        )

                    [2] => Array
                        (
                            [id] => 5
                            [name] => your
                        )

                )

            [created_date] => 14 JAN 2012
        )

    [1] => Array
        (
            [id] => 1101
            [content] => This is content1
            [creator_info] => Array
                (
                    [id] => 2
                    [fname] => abc1
                    [lname] => xyz1
                )

            [tag_info] => Array
                (
                    [0] => Array
                        (
                            [id] => 35
                            [name] => wer
                        )

                    [1] => Array
                        (
                            [id] => 47
                            [name] => cvb
                        )

                    [2] => Array
                        (
                            [id] => 51
                            [name] => mnv
                        )

                )

            [created_date] => 15 JAN 2012
        )

)

with referencing this question, i am using ArrayList.

as follows

Java doesn’t have associative arrays like PHP does.

There are various solutions for what you are doing, but it depends on how you want to look up the information. You can easily write a class that holds all your information and store instances of them into an ArrayList.

public class Foo{
    public String name, fname;

    public Foo(String name,String fname){
        this.name=name;
        this.fname=fname;
    }
}

And then…

List<Foo> foos = new ArrayList<Foo>();
foos.add(new Foo("demo","fdemo");
foos.add(new Foo("test","fname");

So you can access them like…

foos.get(0).name;
=> "demo"

This keeps me happy for single level. If i keeps continue with it, this looks like as a complicated procedure.

I wants something simple procedure with high speed.

Last 3 days i am working in it and i got the success for following

Map<String,Object> myMap1 = new HashMap<String, Object>();
List<Map<String , Object>> myMap  = new ArrayList<Map<String,Object>>();
Map<String,String> user_info = new HashMap<String, String>();
user_info.put("fname", "xyz");
user_info.put("lname", "pqr");
myMap1.put("id", 20);
myMap1.put("content", "This is content");
myMap1.put("creator_info", user_info);
myMap1.put("timestamp", "11 Jan 2012");
myMap.add(0,myMap1);

still not getting that how to do it for tags_info

is there any library for this thing….?

  • 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-05-31T16:09:34+00:00Added an answer on May 31, 2026 at 4:09 pm

    Java does have kind of associative arrays. They are called Maps (see implementations of java.util.Map). With map you can associate value to key, e.g.

    Map<String, String> mymap = new HashMap<String, String>();
    mymap.put("one", "1");
    mymap.put("two", "2"); 
    // etc.
    

    So to solve your problem you can create complex data structure that is a combination of arrays, lists (see java.util.List) and maps.

    But your structure looks too complicated and will not be easily manageable. So, your suggestion is good. Create classes like Foo, probably create yet another that holds several Foo instances etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to iPhone application development, i have used the web services and
As I plan to switch my career to a 100% web services development company(using
I have an Asp.Net MVC application that works in the vs.net development web server.
I am still relatively new to web service development and I need to make
I have recently been programming Web based applications using Silverlight & Ria Services. I
I have added the lines to the web.config to make .html files handled by
I have an android application that relies heavily on Json Web Services. so I
I have seen several postings for issues with consuming AJAX web services and the
MS Cassini Development Web Server is a nice product that executes web requests in
How can automatically I stop the development web server when I stop debugging in

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.