ST_JsonString

Updated at:

Returns the user-defined JSON string stored in a material object. Returns NULL if no user-defined JSON string exists in the material object.

Syntax

cstring ST_JsonString(material material);

Parameters

ParameterDescription
materialThe material object to query.

Return value

Returns a cstring value containing the JSON string that was provided when the material object was created with ST_MakeMaterial.

Examples

Construct a material object and read its JSON string:

The following example builds a material object using ST_MakeMaterial, then retrieves the embedded JSON string.

SELECT ST_JsonString(
  ST_MakeMaterial(
    '{"pbrMetallicRoughness": {"baseColorFactor": [1.000, 0.766, 0.336, 1.0], "metallicFactor": 0.5, "roughnessFactor": 0.1}}',
    ARRAY(SELECT the_texture FROM t_texture)
  )
);

Output:

{"pbrMetallicRoughness":{"baseColorFactor":[1.0,0.766,0.336,1.0],"metallicFactor":0.5,"roughnessFactor":0.1}}

Related functions

  • ST_MakeMaterial — creates a material object with a user-defined JSON string and texture array