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

  • Home
  • SEARCH
  • 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 6061271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:55:09+00:00 2026-05-23T08:55:09+00:00

I was a decent programmer in Python. Now i am forced to do a

  • 0

I was a decent programmer in Python. Now i am forced to do a Wowza Module for my chat application. An application which will login by facebook account and the status of each user is saved on a Wowza Server, which use java for app development, connected via flash client & RTMP. The online status datastructure will be like this in Python.

Please tell me how to represent it in Java, I am not so familar with variable ‘Types’ in java 🙁

x = {
    10001: {
        'status': 0,
        'friends': {}
    },
    10002: {
        'status': 1,
        'friends': {
            10001: 0,
            10003: 1
        }
    },
    10003: {
        'status': 1,
        'friends': {
            10001: 0,
            10003: 1
        }
    }
}

10001,10002 etc will be facebook user ids.. and 0,1 will be their online/offline status.
If 10001 is connected, the datastructure will have some little modifications, it will change the status of 10001 to 1, and add all his friends ids, retrieved from facebook and update their status too.

x = {
    10001: {
        'status': 1,
        'friends': {
            10002: 1,
            10003: 1        
        }
    },
    10002: {
        'status': 1,
        'friends': {
            10001: 1,
            10003: 1
        }
    },
    10003: {
        'status': 1,
        'friends': {
            10001: 1,
            10003: 1
        }
    }
}

And if the user 10001 is disconnected, it will goto earlier stage.
Is there anyway i can store it as a json object? or is there any simple way to Store and retrieve data?

  • 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-23T08:55:10+00:00Added an answer on May 23, 2026 at 8:55 am

    All i needed was http://www.json.org/javadoc/org/json/JSONObject.html library.
    I could use it with little struggle like adding ‘type’ to every object and can’t create the tree in one step as in python.

    Thanks mandubian and jtoberon :))

    import net.sf.json.JSONException;
    import net.sf.json.JSONObject;
    
    public class JSONExample {
        JSONObject json;
        JSONObject objJSON;
        JSONObject objObjJSON;
    
        public void addtoJSON(){
            json = new JSONObject();
            objJSON= new JSONObject();
            objObjJSON =new JSONObject();
    
            //adding last tree
            objObjJSON.put(10001, 0);
            objObjJSON.put(10002, 1);
    
            //adding secondary tree
            objJSON.put("status",1);
            objJSON.put("friends",objObjJSON);
    
            //added root tree
            objJSON.put(10003,objJSON);
    
            System.out.println("JSON is " + objJSON);
    
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Generally speaking, I'm a decent programmer, (C++, Java, Ruby, Python) but I at the
Are there any decent PHP libraries available for accessing SVN repositories? Right now I
I'm a moderately competent Python programmer, and am considering working on my first web-app;
I am a pretty decent programmer in Java, however I am new to programming
I'm a self-taught programmer who jumped into Python as my first language about 7-8
I'm a college student who's had several internships and consider myself a decent programmer.
So I'm a fairly decent javascript programmer and I've just recently finished working on
I'm building a decent sized application in ASP.NET/VB.NET with various objects... I've never used
I have a decent working web application (Java/Servlet/Jsp) that I would like to improve
I'm a decent level PHP web programmer with enough real world experience. I'm also

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.