Source is not valid JSON

Hello,

I’m trying to use the Parse JSON module parse the JSON of something sent to a Mailhook. The Mailhook captures a JSON string excluding the brackets { } (this is because these cannot be included in the email for technical reasons).

In the Parse JSON module, I have the following configuration:

image

I’ve enclosed the response from the Mailhook in brackets which should theoretically make the JSON string passed to the module valid. However, when it’s run on the data from the Mailhook, I get the following error:

The JSON string that it says is invalid is as follows:

{ “First Name”:“R”,“Last Name":“LC”,“Email”:"rlc@test.com”,“Address”:“test address”,“Postal Code”:“34823”,“Phone”:“(123) 752-9345”,“Services”:“Weekly, BiWeekly, Move-In or Move-Out, One-Time Cleaning”,“CustSource”:“Word of Mouth, Valpak Coupon, Saw Your Company Car, Flyer” }

If I copy the JSON string that it says is invalid into jsonlint’s online JSON validator, it says the JSON is valid.

I’m not sure where to go from here in trying to figure out why Make thinks the valid JSON is actually invalid.

Any help would be greatly appreciated. Thank you :blush:

I discovered that what was making the JSON invalid was that either the Mailhook was receiving data with new lines in it or Make was adding new lines to the data (probably the former).

I fixed it by using a simple replace function on the data to replace all new lines with a space. This resulted in the JSON string becoming valid and allowing the scenario to proceed normally.

Screenshot for reference:

image

2 Likes

Heya @rlhc :wave:

Wow! I am impressed by the fact you were able to crack this by yourself. It is truly great to see Makers improve and get more proficient at using Make.:relieved:

Thanks a lot for keeping the community in mind and coming back here with additional information and solution.

Great job and keep it up!

2 Likes