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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:38:20+00:00 2026-06-06T22:38:20+00:00

I am developing an application in which I am using GET REST call to

  • 0

I am developing an application in which I am using GET REST call to get some specific nodes which return’s me the nodes in the below json format:

[

   {

    "nodeId": "30",

    "datasetId": "2",

    "localId": "30",
    "datasetName": "Optimal Travel Route",
    "nodeName": "Location30",
    "nodeDesc": "Find the optimal travel route using travelling salesman problem  ",
    "nodeStatus": "Private",
    "gpsLat": "8.233240",
    "gpsLong": "15.029300",
    "addedBy": "internIITD",
    "addedOn": "2012-06-29 11:08:28",
    "updatedOn": "2012-06-29 11:08:28"
  }

]

they are no newlines .I have added here to make it readable. I am doing this to convert it to string.:

     BufferedReader in = new BufferedReader(new InputStreamReader(
                                      httpCon.getInputStream()));

              String inputLine;
              StringBuilder sb = new StringBuilder();
              while ((inputLine = in.readLine()) != null) {
                  sb.append(inputLine);
                      System.out.println(inputLine);
               }
              String Result;
              Result=sb.toString();
              System.out.println("result:"+Result);

I want to extract the longitude and latitude of the nodes that will be given meeting specific requirements. I am working in NetBeans 7.1.2 . I am new to JAVA.
So , can anyone tell is there any way to extract this latitude and longitde information and store it in integer varibles.
I used to declare JSONObject but it is not working here .I don’t know why?I am not able to use JSONArray or JSONObect in my code. It is showing me an error.In the class in which I am doing this does not have a mail function. this class i.e. file has been called by some other .java file . I have multiple windows in my application.
Please help.

  • 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-06T22:38:22+00:00Added an answer on June 6, 2026 at 10:38 pm

    This would be a solution:

    String jsonSource = /* your json string */;
    JSONArray array = new JSONArray(jsonSource);
    for (int i = 0; i < array.length(); i++) {
        JSONObject firstObject = (JSONObject) array.get(i);
        System.out.println("Lat is:  " + firstObject.getDouble("gpsLat"));
        System.out.println("Long is: " + firstObject.getDouble("gpsLong"));
    }
    

    This would print:

    Lat is:  8.23324
    Long is: 15.0293
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an application which draws some charts and I'm using Google Chart. After
I'm developing an Android application which sends content to a server using rest web
I'm developing application in Java 6 (1.6.0_24) which using transparent JFrame to get disappearing
I am developing one application which is connecting to server to get some data.
I am developing an application in which i am using location service. Basically that
I am developing an iPad application by which i am using image context to
I'm developing an application using the WAF (WPF Application Framework) which is based on
I'm developing an interactive MFC application which displays a 3D object using my own
I'm developing a application using Java RMI which enable clients to register topics they
I am developing blackberry application using BlackBerry JDE 5.0.X , in which i am

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.