Skip to main content
Question

Can't read non-UTF8 json file


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?

9 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • 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
  • April 22, 2020
jdh wrote:

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+16
  • Supporter
  • April 22, 2020
fikusas wrote:

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
  • April 22, 2020
itay wrote:

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+16
  • Supporter
  • April 22, 2020
fikusas wrote:

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
  • April 22, 2020
itay wrote:

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

I see this:


itay
Supporter
Forum|alt.badge.img+16
  • Supporter
  • April 22, 2020
fikusas wrote:

I see this:

looks good to me...


fikusas
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • April 22, 2020
itay wrote:

looks good to me...

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


itay
Supporter
Forum|alt.badge.img+16
  • Supporter
  • April 22, 2020
fikusas wrote:

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

glad I could help


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