Oihana PHP Arango

jsonParse.php

Table of Contents

Functions

jsonParse()  : string
Return an AQL value described by the JSON-encoded input string.

Functions

jsonParse()

Return an AQL value described by the JSON-encoded input string.

jsonParse(string $text) : string

This helper wraps the ArangoDB AQL function JSON_PARSE(text) which parses a JSON string and returns the corresponding AQL value. This is useful for converting JSON strings back into native AQL data types.

Example AQL usage:

JSON_PARSE('{"name": "John"}')    // returns {name: "John"}
JSON_PARSE('[1, 2, 3]')          // returns [1, 2, 3]
JSON_PARSE('"hello"')            // returns "hello"
JSON_PARSE('true')               // returns true
Parameters
$text : string

JSON string expression to parse.

Tags
example
use function oihana\arango\db\functions\strings\jsonParse;

$expr = jsonParse('doc.jsonString');
// Produces: 'JSON_PARSE(doc.jsonString)'
see
https://docs.arangodb.com/stable/aql/functions/string/#json_parse
jsonStringify()

For converting AQL values to JSON strings.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results