JSON/->STRING

Converts a binary string to a JSON string

Input stack: str

Output stack: json

PumpkinDB> "a" JSON/->STRING
"\"a\""

Allocation

Allocates for parsing JSON and encoding a string

Errors

EmptyStack error if there are less than one items on the stack

InvalidValue if supplied string is not a valid UTF-8 string.

Tests

works : "a" JSON/->STRING "\"a\"" EQUAL?.
invalid_str : [0xffff JSON/->STRING] TRY UNWRAP 0x03 EQUAL?.
empty_stack : [JSON/->STRING] TRY UNWRAP 0x04 EQUAL?.

results matching ""

    No results matching ""