Oihana PHP Arango

jsonStringify.php

Table of Contents

Functions

jsonStringify()  : string
Return a JSON string representation of the input value.

Functions

jsonStringify()

Return a JSON string representation of the input value.

jsonStringify(mixed $value) : string

This helper wraps the ArangoDB AQL function JSON_STRINGIFY(value) which converts an AQL value into its JSON string representation. This is useful for serializing AQL data types to JSON format.

Example AQL usage:

JSON_STRINGIFY({name: "John"})    // returns '{"name":"John"}'
JSON_STRINGIFY([1, 2, 3])         // returns '[1,2,3]'
JSON_STRINGIFY("hello")           // returns '"hello"'
JSON_STRINGIFY(true)              // returns 'true'
Parameters
$value : mixed

AQL value expression to convert to JSON string.

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

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

For parsing JSON strings back to AQL values.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results