cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Can't access some(!) imported json values

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?

1 ACCEPTED SOLUTION

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.

View solution in original post

8 REPLIES 8

Hello @daniel.muellner

It's what I was thinking, can you try on a dummy example?

Regards,
Cobra

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

What does return?

CALL apoc.load.json('file:/500products.json')
YIELD value
RETURN value

You can only access what is it in the first screenshot (where you return value), it shows the content which is accessible 🙂

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"

Yeah, Indeed, that's weird It should work. Can you try Return value[0]?

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.