如何修复此 json 查询?
How do I fix this json query?
我正在尝试修复我的 json 查询,但每次我在 json 解析器验证器中复制粘贴时,它都会显示它不正确,但我很难理解我遗漏了什么我对此很陌生。任何线索我错过了什么?
这是我的查询请求:
private final static String QUERY_UPDATE = "\"E\": \"Update\","
+ "\"W\": '{'"
+ "\"Pages\": \"{0}\""
+ "'}'";
和相应的调用:
public static String getUpdate(String code) {
return ComposerUtils.getSimpleQuery(MessageFormat.format(QUERY_UPDATE, new Object[] {
code
}));
}
这是我看到的发送请求:
{ "Entity": { "E": "Update","W": {"Pages": "[{"PageCode":"SP_PAGE_001","IsSelected":"true"},{"PageCode":"SP_PAGE_058","IsSelected":"true"},{"PageCode":"SP_PAGE_014","IsSelected":"true"},{"PageCode":"SP_PAGE_006","IsSelected":"true"},{"PageCode":"SP_PAGE_036"},{"PageCode":"SP_PAGE_012"},{"PageCode":"SP_PAGE_017"},{"PageCode":"SP_PAGE_039"},{"PageCode":"SP_PAGE_009"},{"PageCode":"SP_PAGE_002"},{"PageCode":"SP_PAGE_003"},{"PageCode":"SP_PAGE_004"},{"PageCode":"SP_PAGE_010"},{"PageCode":"SP_PAGE_008"},{"PageCode":"SP_PAGE_028"},{"PageCode":"SP_PAGE_027"},{"PageCode":"SP_PAGE_378"},{"PageCode":"SP_PAGE_060"},{"PageCode":"SP_PAGE_061"},{"PageCode":"SP_PAGE_062"},{"PageCode":"SP_PAGE_064"},{"PageCode":"SP_PAGE_063"},{"PageCode":"SP_PAGE_032"},{"PageCode":"SP_PAGE_023"},{"PageCode":"SP_PAGE_016"},{"PageCode":"SP_PAGE_015"},{"PageCode":"SP_PAGE_660"},{"PageCode":"SP_PAGE_024"},{"PageCode":"SP_PAGE_021"},{"PageCode":"SP_PAGE_031"},{"PageCode":"SP_PAGE_026"},{"PageCode":"SP_PAGE_025"},{"PageCode":"SP_PAGE_019"},{"PageCode":"SP_PAGE_038"},{"PageCode":"SP_PAGE_053"},{"PageCode":"SP_PAGE_033"},{"PageCode":"SP_PAGE_068"},{"PageCode":"SP_PAGE_069"},{"PageCode":"SP_PAGE_497"},{"PageCode":"SP_PAGE_007"},{"PageCode":"SP_PAGE_022"},{"PageCode":"SP_PAGE_035","IsSelected":"true"}]"}}}
设置 JSON 数组时不需要引号:
"Pages":“[.....]”
应该是
"Pages": [ .... ]
我正在尝试修复我的 json 查询,但每次我在 json 解析器验证器中复制粘贴时,它都会显示它不正确,但我很难理解我遗漏了什么我对此很陌生。任何线索我错过了什么? 这是我的查询请求:
private final static String QUERY_UPDATE = "\"E\": \"Update\","
+ "\"W\": '{'"
+ "\"Pages\": \"{0}\""
+ "'}'";
和相应的调用:
public static String getUpdate(String code) {
return ComposerUtils.getSimpleQuery(MessageFormat.format(QUERY_UPDATE, new Object[] {
code
}));
}
这是我看到的发送请求:
{ "Entity": { "E": "Update","W": {"Pages": "[{"PageCode":"SP_PAGE_001","IsSelected":"true"},{"PageCode":"SP_PAGE_058","IsSelected":"true"},{"PageCode":"SP_PAGE_014","IsSelected":"true"},{"PageCode":"SP_PAGE_006","IsSelected":"true"},{"PageCode":"SP_PAGE_036"},{"PageCode":"SP_PAGE_012"},{"PageCode":"SP_PAGE_017"},{"PageCode":"SP_PAGE_039"},{"PageCode":"SP_PAGE_009"},{"PageCode":"SP_PAGE_002"},{"PageCode":"SP_PAGE_003"},{"PageCode":"SP_PAGE_004"},{"PageCode":"SP_PAGE_010"},{"PageCode":"SP_PAGE_008"},{"PageCode":"SP_PAGE_028"},{"PageCode":"SP_PAGE_027"},{"PageCode":"SP_PAGE_378"},{"PageCode":"SP_PAGE_060"},{"PageCode":"SP_PAGE_061"},{"PageCode":"SP_PAGE_062"},{"PageCode":"SP_PAGE_064"},{"PageCode":"SP_PAGE_063"},{"PageCode":"SP_PAGE_032"},{"PageCode":"SP_PAGE_023"},{"PageCode":"SP_PAGE_016"},{"PageCode":"SP_PAGE_015"},{"PageCode":"SP_PAGE_660"},{"PageCode":"SP_PAGE_024"},{"PageCode":"SP_PAGE_021"},{"PageCode":"SP_PAGE_031"},{"PageCode":"SP_PAGE_026"},{"PageCode":"SP_PAGE_025"},{"PageCode":"SP_PAGE_019"},{"PageCode":"SP_PAGE_038"},{"PageCode":"SP_PAGE_053"},{"PageCode":"SP_PAGE_033"},{"PageCode":"SP_PAGE_068"},{"PageCode":"SP_PAGE_069"},{"PageCode":"SP_PAGE_497"},{"PageCode":"SP_PAGE_007"},{"PageCode":"SP_PAGE_022"},{"PageCode":"SP_PAGE_035","IsSelected":"true"}]"}}}
设置 JSON 数组时不需要引号:
"Pages":“[.....]”
应该是
"Pages": [ .... ]