THIS IS CONSIDERED ADVANCED and requires Javascript knowledge but solves the issue of rebuilding raw json and line items to use in code without compromising the integrity like a catch raw hook trigger might.
Let’s say we have line items returned from a trigger and want to rebuild the original JSON structure to parse in a code block.
As a sample, our line items look like the below which results in Zapier merging everything into like fields which can cause issues with null values, nested arrays, text that has commas.
![](https://uploads-us-west-2.insided.com/zapier-ca/attachment/260187e2-8982-4442-9646-3480096c6260.png)
![](https://uploads-us-west-2.insided.com/zapier-ca/attachment/be90ebfd-09aa-4ac1-ad36-b339c238959c.png)
The solution!
You can rebuild your raw json text structure using a Formatter step > Utilities > Line Items to Text.
Take special consideration of preserving the field types. strings should be surrounded by double quotes “”, if a field was a line item you should surround it with square brackets [], etc…
![](https://uploads-us-west-2.insided.com/zapier-ca/attachment/87e3dbae-385d-4dbf-84ac-38c8a27041c1.png)
![](https://uploads-us-west-2.insided.com/zapier-ca/attachment/92f5d286-b5b3-4fe9-a8b6-797e5f5ab5a0.png)
You should get back something that resembles raw json which can then be mapped into a code step surrounded by square brackets allowing you to use things like json.parse to iterate through your data preserving your indexes.
![](https://uploads-us-west-2.insided.com/zapier-ca/attachment/04554443-114c-4982-86e8-e6a6127fc857.png)
![](https://uploads-us-west-2.insided.com/zapier-ca/attachment/cd44c2c1-7636-451a-beeb-54d7486598be.png)