mysql invalid json value and spread to the front of json as much backslash causing the problem can not be resolved

 

MySQL json json add the following fields cause being given, in fact, because meta element in children nodes after more than a comma (because there is no next element added):

[{
            "name": "Test_It",
            "path": "/test",
            "component": "Layout",
            "children": [{
                "name": "Test_It_c",
                "path": "index",
                "component": "Test",
                "meta": {
                    "icon": "example",
                    "title": "后台"
                },
            }]
        }]

 

that's it:

[{
            "name": "Test_It",
            "path": "/test",
            "component": "Layout",
            "children": [{
                "name": "Test_It_c",
                "path": "index",
                "component": "Test",
                "meta": {
                    "icon": "example",
                    "title": "后台"
                }
            }]
        }]

 

Use vue-admin-template routers pass found the time to resolve the failure can not log and found that the back-end pass over the json a lot more backslash escapes, a method using fastjson solved:

userInfoMap.put("routers", JSON.parseArray(roleBean.getRouters()));

 

Guess you like

Origin www.cnblogs.com/kinome/p/12550765.html