Suppose I have a json like below.
```
{
"name" : "Watership Down",
"location" : {
"lat" : 51.235685,
"long" : -1.309197
},
"residents" : [ {
"name" : "Fiver",
"age" : 4,
"role" : null
}, {
"name" : "Bigwig",
"age" : 6,
"role" : "Owsla"
} ]
}
```
if I do
val transformer1 = (__ \ 'name).json.update(of[JsValue].map(a => JsString("x")))
To change the name field at the top level to "x" it works fine.
But if I want to recursively change all the names to "x", I thought I could just use the recursive jsPath, like this (__ \ 'name)
val transformerRecursive = (__ \\ 'name).json.update(of[JsValue].map(a => JsString("x")))
but if I run it. I keep getting error:
```
scala> jsobject.transform(transformerRecursive)
res1: play.api.libs.json.JsResult[play.api.libs.json.JsObject] = JsError(List((//name,List(ValidationError(List(error.path.result.multiple),WrappedArray())))))
```
Can anyone show me how I suppose to use recursive path correctly with Json Transformer in playframework?
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/ac2078af-2288-455e-b863-0c2a05bf9122%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.