Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-20-2020 12:03 PM
I am trying to import a json file and work with the properties.
Weirdly i can only access some of the values.
Here is a sample from the json:
Here is my code to load the json and return a list of names:
CALL apoc.load.json('file:/500products.json')
YIELD value
RETURN value.name
As a result i see the list of names.
This also works for "faulty, url, price and categories".
If i try to access other properties such as "Tiefe, Farbe,...what ever" i receive a list with "nulls".
At first i thought it might be because its capitalized but even if i wrote one parameter like "Breite" as "breite" the list remained full of nulls.
Could it be an issue that these other values are not set with all(!) other json objects?
Any ideas?
Solved! Go to Solution.
08-21-2020 01:03 AM
Okay i found the mistake:
As the json was a result of a web crawler it saved the field with the colons ":" which i somehow always overread and the field (obviously) can't be accessed with the colon...
I have to refactor my file.
08-20-2020 12:07 PM
08-20-2020 12:20 PM
I limited the json two to objects only.
I added "test:"test" to only one of the objects and a list with
"test"
null
returned. This means it does not matter if the field is set in all json objects. (Would have surprised me if this was the problem)
The other fields still cant be accessed / return values of null although the are set and are displayed if i only RETURN value.
Furthermore i wonder about the YIELD "value" variable(?).
I thought this is a freely chosen variable...but once i change it, it throws an error:
Unknown procedure output
08-20-2020 12:23 PM
What does return?
CALL apoc.load.json('file:/500products.json')
YIELD value
RETURN value
08-20-2020 01:00 PM
and
08-20-2020 01:15 PM
You can only access what is it in the first screenshot (where you return value), it shows the content which is accessible 🙂
08-20-2020 01:40 PM
I know and "Gewicht" is the first property of the first json object
Thats why i don't understand why value.Gewicht
returns null but value.Test
returns "test"
08-20-2020 01:43 PM
Yeah, Indeed, that's weird It should work. Can you try Return value[0]
?
08-21-2020 01:03 AM
Okay i found the mistake:
As the json was a result of a web crawler it saved the field with the colons ":" which i somehow always overread and the field (obviously) can't be accessed with the colon...
I have to refactor my file.
All the sessions of the conference are now available online