Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-04-2021 11:08 AM
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?
Solved! Go to Solution.
01-04-2021 11:22 AM
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:
01-04-2021 11:22 AM
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:
01-06-2021 04:51 AM
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
01-05-2021 02:38 AM
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 ?
01-06-2021 08:45 AM
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.
All the sessions of the conference are now available online