I'm trying to create a REST based web service with data encapsulated using JSON. My problem is when I pass the string version of JSON in the URI it turns to something like this: %7B%22coal%22:100,%22ele%22:1500.1%7D.
I'm wondering if there are any functions Java for converting between the escaped and unescaped versions so I can parse the string.
You should be sending any content in the Request body. Only send query parameters in the URI.
Yep, use URLEncoder and/or URLDecoder.
That would be URLDecoder. But unless you are doing something wrong, you shouldn't have to use it, since methods in the Servlet API gnerally return already-decoded strings.
You are not supposed to decode URL escaped text, the web server does that by its own, it should be completely transparent to you.
As some people already pointed out you use URLDecode to unescape a URL string
If on some point of your code you are manually escaping the JSON string that's probably the issue as its getting encoded 2 times.
Your parameters are flat (no lists/objects/etc.).