This is followup of a previous question (Android: Json string with spaces gives "Unterminated object at" exception)
When I get a string from a resource file it removes the " unless it is escaped (\") is there a way around this?
For example:
Java:
String jString = getResources().getString(R.string.event);
Json:
<resources>
<string name="event">
{"Array":[{"Name":"One two three"},{"Name":"Two"},{"Name":"Three"}]}
</string>
</resources>
jString has a value of {Array:[{Name:One two three},{Name:Two},{Name:Three}]} and I want it to have the following value {"Array":[{"Name":"One two three"},{"Name":"Two"},{"Name":"Three"}]}.
You can place the JSON document in res/raw/ and then use openRawResource(int) to get an InputStream from which you can read the JSON.
But depending on the data, I'd prefer saving it in a <string-array> or something like that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With