Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Help with parsing JSON file

Verakso
11 - Bolide

I seem to be stuck on even start to parse a fetched json file, since I am getting the error

 

ConvError: JSON Parse (9): Error message: Invalid value. at character position: 0

So, as you can see, the error occurs even before I get started.

 

The workflow is rather simple

Simple WorkflowSimple Workflow

  1. I am trying to fetch some data from http://api.scb.se/OV0104/v1/doris/en/ssd/START/BE/BE0101/BE0101S/HushallT05, by posting a request in JSON format (Number of Households in Sweden)
  2. I do retrieve a JSON answer, but I suspect that it is the encoding that is the challenge

If I save the result to a temporary file, I can see that the encoding is not UTF-8 but UTF-8 BOM, and those extra bytes in the start makes a big difference.

 

But right now I can't think of a workaround, so I ask the community for some assistance.

 

Any tips or tricks I haven't thought of?

 

Br
/Thomas

 

2 REPLIES 2
Verakso
11 - Bolide

While I am waiting for a more clever answer that this, I did some further spelunking and came up with this 

New WorkflowNew Workflow

So apparently the problem with UTF-8 with BOM is the extra bytes

 

So here I convert the BLOB to a HEX encoded Binary data, then used RegEx to remove those extra bytes.

And I lack of knowledge, I then convert that new HEX encoded Binary back to a BLOB, and the back again from BLOB to Text Encoded string with codepage UTF-8, and then I can parse the JSON file.....

 

But I hope that there is a smarter/easier way than this

 

/Thomas

Jbone
8 - Asteroid

Verasko,

 

Were you able to find a more simple work around for this issue? I have a workflow utilizing an JSON API call that has been working for over a year and just recently started throwing the same "Invalid value. at character position: 0" error. Your solution worked, but I'm not certain what caused the error all of a sudden.

Labels
Top Solution Authors