I have some strange json that I cannot change, and I wish to parse it using
the JsonParsen in lift.
A typical json is like:
{"name":"xxx", "data":{ "data_123456":{"id":"Hello"}, "data_789901":{"id":"Hello"}, "data_987654":{"id":"Hello"}, }}
The issue is that the keys for the data are unknown (data_xxxxx, where the xx:s
are not known).
This is bad json, but I have to live with it.
How am I supposed to setup case-classes in scala to be able to build a proper
structure when the keys here are unknown, but the structure is known?
You can use a Map, and every value can be JValue too, representing unparsed JSON. Example:
And then: