Hi guys.
I'm with a problem when i try to import my json.
[{"CODIGO":1, "NMPRODUTO":"SECADOR DE CABELO ร", "OBS": { "COR" : "PRETO", "VOLTAGEM" : "18V"}}, {"CODIGO":2, "NMPRODUTO":"CADERNO", "OBS": { "QTDPAGINAS" : 500, "MARCA" : "XYZ"}}]
using this code for import
CALL apoc.load.json("file:///c:/TESTE.json")
YIELD value
create( n:PRODUTO { CODIGO:value.CODIGO,
NMPRODUTO:value.NMPRODUTO,
OBS_COR:value.OBS.COR,
OBS_VOLTAGEM:value.OBS.VOLTAGEM,
OBS_QTDPAGINAS:value.OBS.QTDPAGINAS,
OBS_MARCA:value.OBS.MARCA
})
And neo4j returned this error, because I used 'รง' in my json archive.
But I cant remove this special character(รง)
Failed to invoke procedure `apoc.load.json`: Caused by: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x22
at [Source: (apoc.export.util.CountingInputStream); line: 1, column: 48]
Can anyone help me?
clem
(Clem)
January 4, 2021, 7:22pm
2
it seems most probable that your data is bad in someway. Maybe your string is encoded in some system (e.g. one of Microsoft's encodings) instead of UTF-8 (which is more standard nowadays).
see:
You can also use the unix command iconv
to convert your encoded strings to UTF-8.
See:
1 Like
I was able to load the file -
call apoc.load.json("file:///2.json") yield value
merge ( n:PRODUTO { CODIGO:value.CODIGO,
NMPRODUTO:value.NMPRODUTO,
OBS_COR:COALESCE(value.OBS.COR,""),
OBS_VOLTAGEM:COALESCE(value.OBS.VOLTAGEM,""),
OBS_QTDPAGINAS:COALESCE(value.OBS.QTDPAGINAS,""),
OBS_MARCA:COALESCE(value.OBS.MARCA,"")})
Return n
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ"n" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ{"OBS_VOLTAGEM":"18V","OBS_QTDPAGINAS":"","OBS_MARCA":"","CODIGO":1,"NMPRODUTO":"SECADOR DE CABELO ร","OBS_COR":"PRETO"}โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ{"OBS_VOLTAGEM":"","OBS_QTDPAGINAS":500,"OBS_MARCA":"XYZ","CODIGO":2,"NMPRODUTO":"CADERNO","OBS_COR":""} โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Can you verify the checksum of the json file ?
1 Like
Thank's @clem .
I managed to solve the problem using the software "EMEDITOR".
I Opened the json archive and save again with UTF8- encoding and worked very well
clem
(Clem)
January 6, 2021, 4:45pm
5
Sorry, I'm unclear on the your latest response.
I'm not sure what you mean by
Can you verify the checksum of the json file?
but I'm glad it's working now.