JSON to JSON transformer

后端 未结 7 2088
醉话见心
醉话见心 2020-11-30 03:36

I got a scenario.

Required input and output are JSON.

// Input
{
  \"OldObject\": {
    \"Time\": 1351         


        
7条回答
  •  醉酒成梦
    2020-11-30 03:53

    You can try jmom a little java library

    String jsonstring = "...";
    JsonValue json = JsonParser.parse(jsonstring);
    Jmom jmom = Jmom.instance()
                .copy("/OldObject", "/NewObject", true)
                .remove("/NewObject/price")
                .copy("/NewObject/Name", "/NewObject/Title", true);
    jmom.apply(json);
    jsonstring = json.toCompactString();
    

提交回复
热议问题