繁体   English   中英

如何通过在java中读取路径来更新json的值?

[英]How to update the value of json by reading path in java?

我想更新“$.widget.debug”值。 使用哪个库我可以做到这一点。 我尝试了很多图书馆,但无法做到这一点。

{
    "widget": {
        "debug": "on",
        "window": {
            "title": "Sample Konfabulator Widget",
            "name": "main_window",
            "width": 500,
            "height": 500
        }
    }
}

您可以使用 JsonFlattener 库来展平 json。 压扁后就是这个样子。

{
    "widget.debug": "on",
    "widget.window.title": "Sample Konfabulator Widget",
    "widget.window.name": "main_window",
    "widget.window.width": 500,
    "widget.window.height": 500
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM