This may seem an odd requirement but I want to deserialize a JSONStringArray
to a String
, (not a String[]
).
Example of my object
class Retailer {
String name;
String images;
}
Incoming JSON:
{
"name":"Mr Retailer",
"images":[
"http://server.com/image1",
"http://server.com/image2"
]
}
So the parsed object would contain the deserilized values like so:
name = "Mr Retailer"
images = "http://server.com/image1 http://server.com/image2"
The delimiter is not important I will pick one that does not exist in my URLs, e.g. pipe white space etc..
I'm assuming I need to write a TypeAdapter
for String[]
to iterate through the JSONArray and concat the elements in the array into a String?
I also only want to do this for that specific class, as other classes have String[]
but I want to leave them alone.