Layer7 API Management

 View Only

Policy Repository: Concatenate JSON 

Jul 26, 2018 09:30 AM

A simple policy demonstrating how to concatenate two JSON strings. The policy utilizes RegEx to pull the key/value pairs (removing the curly braces).

 

A source variable is set to the below. 

 

{
"user4": "Bill",
"user5": "Mo",
"user6": "Greg"
}

 

This policy will add the above JSON to the existing JSON

 

{
"user1": "Joe",
"user2": "Alec",
"user3": "Matt"
}

 

Resulting in:

 

{
"user1": "Joe",
"user2": "Alec",
"user3": "Matt",
"user4": "Bill",
"user5": "Mo",
"user6": "Greg"
}

Statistics
0 Favorited
7 Views
1 Files
0 Shares
1 Downloads
Attachment(s)
zip file
concat_json.xml.zip   673 B   1 version
Uploaded - May 29, 2019

Tags and Keywords

Related Entries and Links

No Related Resource entered.