How to parse MQTT subtopic with CR LF content?

Hello!

I am subscribed to “subtopic/test” and connected to broker.

When receiving JSON-strings (prettified with CR LF), it’s difficult to parse.

EXAMPLE:

image

This is, what i receive via UART-RX:

subtopic/test -> {\r\n \"int": 219200,\r\n \"double\": 119836.64,\r\n \"string\": \"this is a string\"\r\n}\r\n

where the last CR LF marks the end of the message.

Unfortunately, the message lenght is not received via UART (which would be much easier to parse).

So, how do i know, when the message ends?

Any suggestions?

Best regards,
srcnuzn

Hello.

Sorry for the late reply.

Other customers who use WizFi360 usually use the Json string with characters for packet separation and data parsing.

How about designing a packet like above?

Please refer to it.

Thanks.
Best regards.