Tuesday, January 8, 2013

[android-developers] Re: Send multidimensional array via POST request?

Sorry hit enter too quick. Example below. This creates a value of error containing two addtional name value pairs.

                       JSONObject msgJSON = new JSONObject();
msgJSON.put("error", new JSONObject());
msgJSON.getJSONObject("error").put("code", errorCode);
msgJSON.getJSONObject("error").put("message", msg);
                       String reponse = msgJSON.toString();



On Tuesday, January 8, 2013 2:54:00 PM UTC-5, George Baker wrote:
I would also recommend JSON.  As Nobu said it is compact and many server side programming languages have libraries readily available for it.  Otherwise as far as I know mimicking a  form post doesn't offer an input type that natively supports an embedded name value pair. 

Here's an example on how to write one

                      JSONObject msgJSON = new JSONObject();
msgJSON.put("error", new JSONObject());
msgJSON.getJSONObject("error").put("code", errorCode);
msgJSON.getJSONObject("error").put("message", new JSONObject());
msgJSON.getJSONObject("error").getJSONObject("message").put("lang","en-us");
msgJSON.getJSONObject("error").getJSONObject("message").put("value",errorMessage);
msgJSON.put("value",errorMessage);

On Saturday, January 5, 2013 12:03:01 PM UTC-5, Roman Bugaian wrote:
It's simly to send POST reaquest with Lists consisting of BasicNameValuePair, but how to send a pair, where a value is another list of pairs?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment