Skip to main content

i need to get the email address from this

 

>{""email"":""228_mg_primarydistribution@hotmail.com""}]

 

 

And

 

{

 "token": "-QPWNTxHkE4R1TM8u_M1AOUohy0X2i69BMJBEy0oUDZnqugzS4IKCWiAMrI6YqbLDxJKDyahZ0vrhoAj7FQ49EM4AWkxohFN54D5vJJLzxxR6M_3xcb2mI4iG8E0WDj3fR1my34kAB0_oRNcfNlueTm-jwpxb-OI6WxCJoLkvzaF9y74XYmGUbBeISz1Wmr-U5nFxUCrXbVOtEt5bd9Qh5qwrc9nZeZ6W7uP0oUyXs-wmqHxFxXOl7dhho4LmD-0bo2525vNwKvEZRsgfn6ep8WC264IfwNW7h7UvFX1d6Y.",

 "expires": 1665744258308,

 "ssl": true

}

 

and other query i need extract only bold values

For the first one you can use a JSONExtractor with the following expression:

jsone0]c"email"]

This will extract the first element of the outer JSON list, then retrieve the value of the "email" key within that element.

It's pretty much the same for the second one, except that there's no list, so you can query the value directly:

json "token"]

You can read more about these expressions in the documentation: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/jsonfragmenter.htm#JSON_Queries

This one is perhaps the best introduction if you're not too familiar with JSON: https://community.safe.com/s/article/tutorial-getting-started-with-json


its rejecting

 

 imageimageimage


for 2nd i get this error

 

image


The configuration of the JSONExtractor is most likely wrong. It should look something like this:

image


give me same error


fin the attach WS


fin the attach WS

The attachement only contains the log, not the workspace. Can you please rather post a screenshot of your JSONExtractor settings.


its rejecting

 

 imageimageimage

The configuration of the JSONExtractor in the screenshot above is wrong, please compare to the screenshot I posted below.


 

imageimage


 

imageimage

Check if the quotes (") of the contents of attribute sent_to are doubled, they seem to be in the example at the top of this post, and that's not valid JSON.

If yes, you can use a StringReplacer to replace "" with " before the JSONExtractor.


Reply