如何修复此json查询?

时间:2015-08-20 19:00:32

标签: android json getjson jsonpath jsonresponse

我正在尝试修复我的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"}]"}}}

1 个答案:

答案 0 :(得分:1)

设置JSON数组时不需要引号:

“Pages”:“[.....]”

应该只是

“页数”:[....]