Skip to content

got an error and cann't figure it out #1351

Description

@addriumruss

This is my string, which is received from a java server through rabbitmq:

{"cmd":"CONFIG","data":{"para":{"data":{"algorithmSN":0,"algorithmType":0,"cmd":"CONFIG","pid":0,"setAlgorithmSN":false,"setAlgorithmType":false,"setCmd":true,"setParas":false,"setPid":false,"setSn":false,"setTaskId":false},"setData":true,"setState":true,"state":"PUSH"}}}

and got error output:
消息处理异常: [json.exception.type_error.302] type must be string, but is null

but when I extract these string out to a single test cpp file, it parses ok.
this is my test file:

char *str2 = "{\"cmd\":\"CONFIG\",\"data\":{\"para\":{\"data\":{\"algorithmSN\":0,\"algorithmType\":0,\"cmd\":\"CONFIG\",\"pid\":0,\"setAlgorithmSN\":false,\"setAlgorith
mType\":false,\"setCmd\":true,\"setParas\":false,\"setPid\":false,\"setSn\":false,\"setTaskId\":false},\"setData\":true,\"setState\":true,\"state\":\"PUSH\"}}}";
auto doc = json::parse(str2);
string str2_2 = doc.dump();
printf("str2_2=%s \n", str2_2.c_str()); 

is something wrong with my string data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: needs more infothe author of the issue needs to provide more details

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions