Find answers from the community

Updated 10 months ago

Hello, I tried to use JSONNodeparser and

Hello, I tried to use JSONNodeparser and got this error :
AttributeError
'tuple' object has no attribute 'id'
File "/home/mec/dekstop/llamaIndex/script.py", line 511, in <module>
nodesDesc = parser.get_nodes_from_documents(description)
AttributeError: 'tuple' object has no attribute 'id'

With this code :
parser = JSONNodeParser()
description = Document(text=str(descriptionJson))
nodesDesc = parser.get_nodes_from_documents(description)


Where descriptionJson is a dict
Any idea ?
v
r
3 comments
You need a list of Documents
parser = JSONNodeParser() descriptions = [Document(text=str(descriptionJson))] nodesDesc = parser.get_nodes_from_documents(descriptions)

Try with that
It works but it doesn't parse anything..
I don't understand how it should work. Like I am literally giving a string of a dict
Add a reply
Sign up and join the conversation on Discord