How i can add a List to the JSON POST request with webwrite (required for RESTful interface of Neo4j)
Mostra commenti meno recenti
The following RESTful JSON Interface is needed to submit a Query (e.g. Node creation) to a Neo4j-Database:
{
"statements" : [ {
"statement" : "CREATE (n) RETURN id(n)"
} ]
}
The JSON-Object is created internal the WEBWRITE-Function. The nested structure can be created in Matlab and is compiled to JSON by the WEBWRITE-Function as well. I was unable to create a JSON List (Array) by using the following approach (Cell Array):
api = 'http://localhost:7474/';
url = [api 'db/data/transaction/commit'];
statem{1,1} = 1;
ab = struct('statement', 'CREATE (n) RETURN id(n)');
statem{1,1} = ab;
statems = struct('statements', statem);
options = weboptions('ContentType','json', 'MediaType','application/json', 'RequestMethod','POST', 'Username', 'neo4j', 'Password', 'test');
data = webwrite(url, statems, options);
JSON-Result created by the function above:
{
"statements": {
"statement": "CREATE (n) RETURN id(n)"
}
}
Is there a way to create a List in the JSON-Object created by WEBWRITE?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su JSON Format in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!