Skip to main content
Question

Can't read non-UTF8 json file

  • April 21, 2020
  • 9 replies
  • 78 views

fikusas
Contributor
Forum|alt.badge.img+5

I'm trying to read in JSON file. It has ANSI encoding. The reader throws an error:

"A JSON syntax error was found at line 1, column 49. A sequence of bytes was found which is invalid in the UTF-8 encoding."

Is it possible to get around this?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

9 replies

jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • April 21, 2020

You can read the JSON with a text file reader, which has a parameter to specify the encoding, and then use the various JSON transformers to turn the text string into features with attributes.


fikusas
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 75 replies
  • April 22, 2020

You can read the JSON with a text file reader, which has a parameter to specify the encoding,  and then use the various JSON transformers to turn the text string into features with attributes.

How can this be splitted into separate attributes when read in with text reader?

   },
   {
      "objektokodas" : 50002363,
      "pavadinimas" : "7-2, 7-5, 7-6, 7-7, 7-8, unikalus numeris 1094-0073-0016:0031, plotas 65,35 kv. m, pusr?syje",
      "adresas" : "V. Sopeno g. 12, Vilnius",
      "teritorija" : "Vilnius",
      "weblink" : "https://www.turtas.lt/8952",
      "aukcionas" : {
         "skelbimoPavadinimas" : "Negyvenamosios patalpos",
         "arElektroninisAukcionas" : true,
         "objektoPradineKaina" : 155700,
         "zemesPradineKaina" : null,
         "sklypasNuomojamas" : false,
         "aukcionoData" : "2019-12-09T09:00:00",
         "registracijosPradzia" : "2019-12-02T00:00:00",
         "registracijosPabaiga" : "2019-12-04T23:59:00",
         "weblink" : null
      },
      "statiniai" : []
   },

itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • April 22, 2020

How can this be splitted into separate attributes when read in with text reader?

   },
   {
      "objektokodas" : 50002363,
      "pavadinimas" : "7-2, 7-5, 7-6, 7-7, 7-8, unikalus numeris 1094-0073-0016:0031, plotas 65,35 kv. m, pusr?syje",
      "adresas" : "V. Sopeno g. 12, Vilnius",
      "teritorija" : "Vilnius",
      "weblink" : "https://www.turtas.lt/8952",
      "aukcionas" : {
         "skelbimoPavadinimas" : "Negyvenamosios patalpos",
         "arElektroninisAukcionas" : true,
         "objektoPradineKaina" : 155700,
         "zemesPradineKaina" : null,
         "sklypasNuomojamas" : false,
         "aukcionoData" : "2019-12-09T09:00:00",
         "registracijosPradzia" : "2019-12-02T00:00:00",
         "registracijosPabaiga" : "2019-12-04T23:59:00",
         "weblink" : null
      },
      "statiniai" : []
   },

Hi @fikusas,

As mentioned by @jdh, you can use JSOn transformers to extract the data.

 

 

0684Q00000ArMsjQAF.png

When reading the JSON as text make sure you are reading the whole file as one attribute value:

0684Q00000ArN54QAF.png

 

Hope this helps.


fikusas
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 75 replies
  • April 22, 2020

Hi @fikusas,

As mentioned by @jdh, you can use JSOn transformers to extract the data.

 

 

When reading the JSON as text make sure you are reading the whole file as one attribute value:

 

Hope this helps.

Flattener gives me this:

and ListExploder ends up with this:

What I'm doing wrong?

itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • April 22, 2020

Flattener gives me this:

and ListExploder ends up with this:

What I'm doing wrong?

and if you inspect the results from the ListExploder in de feature information window?


fikusas
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 75 replies
  • April 22, 2020

and if you inspect the results from the ListExploder in de feature information window?

I see this:


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • April 22, 2020

I see this:

looks good to me...


fikusas
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 75 replies
  • April 22, 2020

looks good to me...

AtributeExposer did the trick. Now I can see attributes in Visual Preview. Thanks!


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • April 22, 2020

AtributeExposer did the trick. Now I can see attributes in Visual Preview. Thanks!

glad I could help