Skip to content

JSON 파싱 오류: [json.exception.parse_error.101] parse error at line 1, column 2264: syntax error while parsing value - unexpected '{'; expected end of input. Please help me resolve the expected end of input error. #4225

Closed Answered by gregmarr
CheongYa asked this question in Q&A
Discussion options

You must be logged in to vote

[json.exception.parse_error.101] parse error at line 1, column 2264: syntax error while parsing value - unexpected '{'; expected end of input.

Your provided input is 2263 characters, that tells me that when there are two clients, the two strings get combined into one. You need to make sure that you are only parsing one string at a time.

                   std::istream is(&buffer_);
                   std::string message;
                   std::getline(is, message);
                   // DB에 저장
                   SaveToDatabase(message);

I suspect that your client messages don't end with a newline, and thus std::getline pulls them both at once.

Replies: 4 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@nlohmann
Comment options

@CheongYa
Comment options

Comment options

You must be logged in to vote
4 replies
@CheongYa
Comment options

@CheongYa
Comment options

@CheongYa
Comment options

@gregmarr
Comment options

Answer selected by CheongYa
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants