REMOVE INDENTATION IN JSON
In this tutorial, we will see how we can remove indentation between the JSON elements. it’s a good practice to compress the JSON response when it’s returned to any web browser or mobile application. This will reduce the size of the JSON and become easy to transfer the JSON content.
You can use indent = false in the header section
Example 1 :
Input: [112, 113]
Dataweave 2.0 Expression
%dw 2.0 output application/json indent = false ---- payload
Output:
[112,113]
Example 2 :
Input:
{ "id" : "1", "message" : "Hello World" }
Dataweave 2.0 Expression
%dw 2.0 output application/json indent = false ---- payload
Output:
{"id": "1","message": "Hello World"}
Post Submitted by:
|
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.