Search code examples
jsoncsvarangodbarangoimport

Read embedded JSON-Object in a CSV-file via arangoimp


Having a CSV-File as follows (modeled from the IRIS data-set):

Species,values
setosa,"{""Sepal.Length"":5.1,""Sepal.Width"":3.5,""Petal.Length"":1.4,""Petal.Width"":0.2}"
setosa,"{""Sepal.Length"":4.9,""Sepal.Width"":3,""Petal.Length"":1.4,""Petal.Width"":0.2}"
setosa,"{""Sepal.Length"":4.7,""Sepal.Width"":3.2,""Petal.Length"":1.3,""Petal.Width"":0.2}"
setosa,"{""Sepal.Length"":4.6,""Sepal.Width"":3.1,""Petal.Length"":1.5,""Petal.Width"":0.2}"
setosa,"{""Sepal.Length"":5,""Sepal.Width"":3.6,""Petal.Length"":1.4,""Petal.Width"":0.2}"
setosa,"{""Sepal.Length"":5.4,""Sepal.Width"":3.9,""Petal.Length"":1.7,""Petal.Width"":0.4}"

How can i read the values column as object instead of string?

Using

arangoimp --file /Desktop/iris.csv --type csv --collection iris --create-collection true

This gives me two strings per row....

In the GUI i get:

enter image description here

Whereas this i what i try to achieve:

enter image description here


Solution

  • arangoimp only allows imporing csv or json but can not mix them.

    The easiest way should converting your csv file into json format and then import it (see docs).