0
如何使用基於同級屬性的scala lift來轉換下面的json? 在下面的JSON,我想價值在「值」編碼屬性如果同級屬性「類別」爲「HTML」如何使用scala lift來轉換json?
val json = """
{
"id" : "1B23423B",
"payload" : {
"list" : [ {
"name" : "test",
"data" : [ {
"value" : "Some html",
"type" : "html",
}, {
"value" : "some text",
"type" : "text"
}]
}]
}
}
"""
def encode(s:String):String = s + "encoded"
val newjson = js.transform {
case x if x == JField("type",JString("html")) => // somehow encode value??
}
println(newjson)
JSON數據的偉大工程!謝謝! –