cancel
Showing results for 
Search instead for 
Did you mean: 

Some json strings questions

Richard
New Contributor III

Hi
We are just starting off with SnapLogic and we wonder if somebody can give us some answers to the following questions.

We have the following input
[

{

transactionId:“F59AE026-8AEA-4F69-BE97-F7AB981AC3BF”,LineCreationSequenceNumber:1,ItemNumber:“99999999991”,OrderedSalesQuantity:1,SalesPrice:120,AVAPromotionCode:null,SalesUnitSymbol:“UN”,SalesProductCategoryName:null,AVALaserText:null,AVAWrappingText:null,
original:{erpOrderNumber:“JEM-99999”,clientOrderNumber:“00118204”}

},
{
transactionId:“F59AE026-8AEA-4F69-BE97-F7AB981AC3BF”,LineCreationSequenceNumber:2,ItemNumber:“99999999994”,OrderedSalesQuantity:2,SalesPrice:80.93,AVAPromotionCode:null,SalesUnitSymbol:“UN”,SalesProductCategoryName:null,AVALaserText:null,AVAWrappingText:null,
original:{erpOrderNumber:“JEM-99999”,clientOrderNumber:“00118205”}
}
]

I have the following questions

  1. How do we remove the “original” object from the lines with expression language?
  2. How can we remove key "transactionId"and value from the lines with expression language?
  3. Once the original object is removed how can we convert the lines into an array with name “orderLines” with expression language?

Thanks for your help

5 REPLIES 5

bojanvelevski
Valued Contributor

Hey @vcocco,

The sample data provided is incorrect. First, it’s not properly formatted. While posting data samples or expressions, you should always use the “Preformatted text” option.

image

Second, the Keys in JSON should always be in double quotes, and values to, if they are string of course. You can read more about JSON on the following link:

JSON W3Schools

But as a contrast for better understanding, I formatted the same sample in the right format:

[
	{
		"transactionId": "F59AE026-8AEA-4F69-BE97-F7AB981AC3BF",
		"LineCreationSequenceNumber": 1,
		"ItemNumber": "99999999991",
		"OrderedSalesQuantity": 1,
		"SalesPrice": 120,
		"AVAPromotionCode": null,
		"SalesUnitSymbol": "UN",
		"SalesProductCategoryName": null,
		"AVALaserText": null,
		"AVAWrappingText": null,
		"original": {
			"erpOrderNumber": "JEM-99999",
			"clientOrderNumber": "00118204"
		}
	},
	{
		"transactionId": "F59AE026-8AEA-4F69-BE97-F7AB981AC3BF",
		"LineCreationSequenceNumber": 2,
		"ItemNumber": "99999999994",
		"OrderedSalesQuantity": 2,
		"SalesPrice": 80.93,
		"AVAPromotionCode": null,
		"SalesUnitSymbol": "UN",
		"SalesProductCategoryName": null,
		"AVALaserText": null,
		"AVAWrappingText": null,
		"original": {
			"erpOrderNumber": "JEM-99999",
			"clientOrderNumber": "00118205"
		}
	}
]