Permite exportar o objeto JSON para uma string em formato JSON.
Sintaxe
JsonObject:toJSON( )
Retorno
Nome | Tipo | Descrição |
|---|---|---|
cJSON | caractere | Retorna o objeto em uma string em formato JSON |
Exemplo
user function toJsonExemplo()
local oJson
local ret
oJson := JsonObject():new()
ret := oJson:fromJson('{"character":"Joaquim", "json":{"Joao":22, "Joana":33}, "array":[4,12,5], "numeric":23, "logic":false, "nil":null}')
if ValType(ret) == "U"
Conout("JsonObject populado com sucesso")
else
Conout("Falha ao popular JsonObject. Erro: " + ret)
endif
conout(oJson:toJson())
/*
Será impresso:
{"character":"Joaquim","numeric":23,"logic":false,"array":[4,12,5],"nil":null,"json":{"Joana":33,"Joao":22}}
*/
return
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas