您好,SO社区:)!
我想创建一种方法,该方法将允许用户编辑(或添加)JSON特定值或对象(通过JSONPath在JSON中定位)。下面简单的例子是我的想法。用户始终输入JSON,JSONPath和要更改的值/对象。我正在使用Json.NET库。
方法输入 {json,jsonpath,valuetoedit} || 输出 {new json as string}
输入示例:
{ "store": {
"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{ "category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{ "category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": { …Run Code Online (Sandbox Code Playgroud)