How i can add a List to the JSON POST request with webwrite (required for RESTful interface of Neo4j)
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur JSON Format dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!