Loading ...
Sorry, an error occurred while loading the content.

Convert String - JSON

Expand Messages
  • rubao
    Hi, I am developing an application with GIS and a hand me the server returns a string containing a JSON object. I need to go through this object to separate
    Message 1 of 3 , Sep 17, 2009
    • 0 Attachment
      Hi, I am developing an application with GIS and a hand me the server returns a string containing a JSON object. I need to go through this object to separate the fields, what happens is that he came in the form of String. How can you convert this String in JSON, I tried this way and it did not work:

      # JSONArray ja = new JSONArray (objetos.toString ()); / / objects is my json array
    • Fredag_d13
      ... If your server string contains a json-object then parse it to an object, if its a json-array then parse it into an array. Pick a JSON-implementation at
      Message 2 of 3 , Sep 17, 2009
      • 0 Attachment
        --- In json@yahoogroups.com, "rubao" <diegorrborges@...> wrote:
        >
        >
        > Hi, I am developing an application with GIS and a hand me the server returns a string containing a JSON object. I need to go through this object to separate the fields, what happens is that he came in the form of String. How can you convert this String in JSON, I tried this way and it did not work:
        >
        > # JSONArray ja = new JSONArray (objetos.toString ()); / / objects is my json array
        >

        If your server string contains a json-object then parse it to an object, if its a json-array then parse it into an array. Pick a JSON-implementation at www.json.org to do the work. If the implementation does not allow json-arrays to be parsed directly, then wrap the array into a dummy object, ie.: "{ \"dummy\": "+server_string+"}"
      • Diego Roberto
        Thank you for your attention. Reading the documentation could utilizare eval that solved my problem. Thank you. 2009/9/17 Fredag_d13
        Message 3 of 3 , Sep 17, 2009
        • 0 Attachment
          Thank you for your attention.
          Reading the documentation could utilizare "eval" that solved my problem.

          Thank you.

          2009/9/17 Fredag_d13 <jonas@...>

          >
          >
          > --- In json@yahoogroups.com <json%40yahoogroups.com>, "rubao"
          > <diegorrborges@...> wrote:
          > >
          > >
          > > Hi, I am developing an application with GIS and a hand me the server
          > returns a string containing a JSON object. I need to go through this object
          > to separate the fields, what happens is that he came in the form of String.
          > How can you convert this String in JSON, I tried this way and it did not
          > work:
          > >
          > > # JSONArray ja = new JSONArray (objetos.toString ()); / / objects is my
          > json array
          > >
          >
          > If your server string contains a json-object then parse it to an object, if
          > its a json-array then parse it into an array. Pick a JSON-implementation at
          > www.json.org to do the work. If the implementation does not allow
          > json-arrays to be parsed directly, then wrap the array into a dummy object,
          > ie.: "{ \"dummy\": "+server_string+"}"
          >
          >
          >



          --
          ________________________________________________
          Diego Roberto
          (62) 9619-0902
          "Corra atrás dos seus sonhos... Eles são a única coisa que te acompanham até
          quando vc está dormindo!!!"

          ________________________________________________


          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.