Skip to main content
Question

Writing a JSON file from a URL

  • January 17, 2020
  • 3 replies
  • 156 views

salvaleonrp
Enthusiast
Forum|alt.badge.img+15

A Rest query resulted to a JSON result which includes a URL to another JSON file from the host server. I want to download that JSON URL so I can save it on my computer and then read it as well.

For some reason just passing the URL from the JSON flattener and configuring the dataset of the FeatureReader with Format: JSON with that url attribute is not working.

It would be good to just implement this with FME Server as a download service but right now I'm limited to Desktop. At the very least I want to read the JSON from the server and it's also not working either.

I tried File Copy Writer by parsing the json filename on the URL and it did not work either.

3 replies

Forum|alt.badge.img+2

Hi @salvaleonrp,

Are there any errors or warnings reported in the translation log?

If you copy and paste the URL into the web browser does it download the file successfully?

Does the URL allow for unauthenticated access? If no you may need to use the HTTPCaller to download the file before reading it in.


takashi
Influencer
  • January 17, 2020

Firstly check if the JSONFlattener works as you expected. Connect an Inspector to the JSONFlattener instead of the FeatureReader and run. Is the URL retrieved correctly?


salvaleonrp
Enthusiast
Forum|alt.badge.img+15
  • Author
  • Enthusiast
  • January 18, 2020
hollyatsafe wrote:

Hi @salvaleonrp,

Are there any errors or warnings reported in the translation log?

If you copy and paste the URL into the web browser does it download the file successfully?

Does the URL allow for unauthenticated access? If no you may need to use the HTTPCaller to download the file before reading it in.

Q1: No errors or warnings.

Q2: Yes.

Q3: Authentication is not required.

As suggested, I used the HTTPCaller and it solved my problem.

 

Pretty cool to see the JSON return from the HTTP caller. With a TextFile writer from the output port of the HTTPCaller, I can now save a copy of the JSON to my computer and now work on my JSON to continue translation.

 

Thanks!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings