filmov
tv
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"}
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"}