I have json file as below -
{
"items" : [ {
"book" : 'abc'
},
{
"book" : '123'
},{
"book" : 'xyz'
}
]
}
I used below mlcp command but getting error like "leading space".
mlcp.bat import -host localhost -port 7003 -username admin -password admin -input_file_path C:\CR -input_file_type delimited_json
what is the best way to load this json file as multiple file for each book field. So post ingestion I should have 3 files, one for each book field.
MLCP expects each line in the file of a
delimited_jsonto be a line of JSON.https://docs.marklogic.com/11.0/guide/mlcp-guide/en/importing-content-into-marklogic-server/creating-documents-from-line-delimited-json-files/line-delimited-json-overview.html
It isn't going to parse the JSON doc and read the
itemsarray as separate docs.You can achieve that in a custom ingest transform though. This similar question has an example demonstrating how to read the JSON and create a document for each item in an array: https://stackoverflow.com/a/36506478/14419