Open
Description
Eg the Json is
val myJson = "properties" : {
}
val json = JsonPath.parse(myJson).set("$.properties.image.source", "my_image_url").jsonString()
Log.d("", "JSON UPDATED $json")
returns
"properties" : {
}
instead of
"properties" : {
"image" :{
"source" : "my_image_url"
}
}
The test method in Kotlin.
@Test
fun testJsonPathSet() {
val jsonString = "{\"properties\": {}}"
val newJson = JsonPath.parse(jsonString).set("$.properties.image.source", "image_url").jsonString()
val expectedNewJson = "{\"properties\":{\"image\":{\"source\":\"image_url\"}}}"
Assert.assertEquals(expectedNewJson, newJson)
}
Metadata
Metadata
Assignees
Labels
No labels