Java convert JSONObject to URL parameter

Posted by Alex Ivasyuv on Stack Overflow See other posts from Stack Overflow or by Alex Ivasyuv
Published on 2010-12-23T11:26:42Z Indexed on 2010/12/23 11:54 UTC
Read the original article Hit count: 240

Filed under:
|
|
|
|

What is the elegant way to convert JSONObject to URL parameters. For example, JSONObject:

{stat: {123456: {x: 1, y: 2}, 123457: {z: 5, y: 2}}}}

this should be like:

stat[123456][x]=1&stat[123456][y]=2&stat[123457][z]=5&stat[123457][y]=2

of course with escaped symbols, and of course JSON object could be more complicated.. Maybe there already exist some mechanisms for that?

Thanks,

© Stack Overflow or respective owner

Related posts about java

Related posts about android