You can use the Json node set to format json string or JSON.stringyfy() to output pretty Json.
e.g.
[{"id":"586d5dc3.93661c","type":"inject","z":"20bb0f7f9fab47a8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"text1\":\"text1\",\"text2\":\"text2\"}","payloadType":"json","x":140,"y":620,"wires":[["5459f2fa.d5e2f4","13594dec.b8ac82"]]},{"id":"13594dec.b8ac82","type":"json","z":"20bb0f7f9fab47a8","name":"","property":"payload","action":"","pretty":true,"x":360,"y":600,"wires":[["3e0ad2eb.1a47ae"]]},{"id":"5459f2fa.d5e2f4","type":"function","z":"20bb0f7f9fab47a8","name":"","func":"msg.payload = JSON.stringify(msg.payload, null, 2); \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":660,"wires":[["3e0ad2eb.1a47ae"]]},{"id":"3e0ad2eb.1a47ae","type":"debug","z":"20bb0f7f9fab47a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":800,"wires":[]}]
output
{
"text1": "text1",
"text2": "text2"
}