I have a class TEntrega
, which in turn has a variable TObjectList<TItens>
I need to generate a JSON from this class to send to a webservice. For this, I used TJson.ObjectToJsonString(Self)
. My result was as follows:
{
"itens": {
"ownsObjects": true,
"listHelper": [
2
],
"items": [
{
"cod_produto_erp": "315524",
"descricao": "LUMINARIA FLUOR1X40W ABERTA",
"unidade": "",
"qtd": "1",
"preco": "7.8",
"subtotal": "7.8",
"valor_icms_st": "",
"ncm": "",
"cst": ""
},
{
"cod_produto_erp": "425513",
"descricao": "N\u00c3O LUMINARIA FLUOR40X1W FECHADA",
"unidade": "",
"qtd": "10",
"preco": "8.7",
"subtotal": "87.0",
"valor_icms_st": "",
"ncm": "",
"cst": ""
}
]
}
}
The ObjectToJsonString
function has generated some extra fields, such as ownsObjects , listHelper , and items .
How can I generate a "clean" Json without these fields? Is there any option in REST.Json or REST.JsonReflect that can help me without writing a Json Generator from scratch?