Results 1 to 6 of 6
  1. #1
    PinkRose is offline Member
    Join Date
    Feb 2014
    Posts
    17
    Rep Power
    0

    Default how to assess array values from Json Request

    Hi,
    I want to retreive array values from json response. can anyone help me how to work out it.

    sample Json:
    {
    "UID": "UID",
    "AID": "AID",
    "Answers": [
    {
    "QID": "QID 1",
    "QResponse": true,
    "Response": "Choice ID 1"
    },
    {
    "QID": "QID 2",
    "QResponse": true,
    "Response": ["Choice ID 1","Choice ID 2"]
    },
    {
    "QID": "QuestionID 3",
    "QResponse": false,
    "Response": ""
    }
    ]
    }
    this is the sample json request. how do i retrieve the response values?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: how to assess array values from Json Request

    Well you need any API to parse the JSON data to an object and get the information. Google GSON is one of many options.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    PinkRose is offline Member
    Join Date
    Feb 2014
    Posts
    17
    Rep Power
    0

    Default Re: how to assess array values from Json Request

    hi,
    thank you. I will try it.

  4. #4
    PinkRose is offline Member
    Join Date
    Feb 2014
    Posts
    17
    Rep Power
    0

    Default Re: how to assess array values from Json Request

    hi,
    i am new to web services. currently i am creating a web services api. i am receiving a request from client and it is consumes as json request. i created corresponding bean class. Does Gson api works for this?

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: how to assess array values from Json Request

    Your question becomes very different. You ask for B and you want A.

    I think you need to look into using the JAX-RS API in stead of re-inventing the wheel yourself. https://jersey.java.net/
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    PinkRose is offline Member
    Join Date
    Feb 2014
    Posts
    17
    Rep Power
    0

    Default Re: how to assess array values from Json Request

    Thank you

Similar Threads

  1. HTTP POST request using JSON
    By blertadhimitri in forum New To Java
    Replies: 8
    Last Post: 12-20-2013, 12:01 PM
  2. JSON Array Loop Inserting into Android SQLite Database
    By viviosoft in forum New To Java
    Replies: 6
    Last Post: 09-26-2011, 10:34 AM
  3. Replies: 14
    Last Post: 01-22-2011, 02:36 PM
  4. DB Values to JSON
    By prakashkadakol in forum New To Java
    Replies: 1
    Last Post: 01-05-2010, 06:19 PM
  5. Replies: 0
    Last Post: 11-21-2008, 08:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •