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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:26:52+00:00 2026-06-17T11:26:52+00:00

I have recently settup a php page on my server that runs through my

  • 0

I have recently settup a php page on my server that runs through my database and outputs this onto the page.

JSONObject json = JSONfunctions.getJSONfromURL("http://abc.com/getjson.php");

        try{

            JSONArray  myArray = json.getJSONArray("date");

            for(int i=0;i<myArray.length();i++){                        
                HashMap<String, String> map = new HashMap<String, String>();    
                JSONObject e = myArray.getJSONObject(i);

                map.put("id",  String.valueOf(i));
                map.put("date", "date name:" + e.getString("date"));
                map.put("activity", "activity: " +  e.getString("activity"));
                mylist.add(map);            
            }

http://abc.com/getjson.php outputs:

[{"date":"2012-04-23","activity":"gym"},{"date":"2012-04-24","activity":"walkin‌​g"}]
  • 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-17T11:26:53+00:00Added an answer on June 17, 2026 at 11:26 am

    parse json string as to get date :

    JSONArray  myArray=JSONfunctions.getJSONfromURL("http://abc.com/getjson.php");
    
    for(int i=0;i<myArray.length();i++){
    
    JSONObject  myobj = myArray.getJSONObject(i);
    
     // get date here
      String strdate=myobj.getString("date");
    
     // get activity here
      String stractivity=myobj.getString("activity");
    }
    

    because current json String Structure is JSONArray -> JSONObject -> key-value .

    EDIT : you will need to change return type of getJSONfromURL method to JSONArray instead of JSONObject because you are getting JSONArray as root element instead of JSONObject from server

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

Sidebar

Related Questions

I have recently had a linux server compromised from bots uploading .php scripts and
i am on windows/apache/mysql/php setup. i have recently reinstalled PHP. but i found that
I have a server (VPS) that hosts numerous PHP / MySQL websites. Most are
I have recently made changes in some code that makes a char name field
just simple question, recently i have setup a web server to build project using
I have recently seen some code that I do not completely understand. There is
I've recently setup an inhouse git repository server and have it up and running
I've PHP application that sends pushes to different kinds of smartphones. Recently BlackBerry push
I've recently setup my Ubuntu web server with exim4 so my PHP website applications
I have recently written a script in python that processes a Microsoft Windows DHCP

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.