GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
WINDEV 25
→
WD - Exemplo de desserializar um objeto JSON multinível (níveis de aninhamento)
WD - Exemplo de desserializar um objeto JSON multinível (níveis de aninhamento)
Iniciado por BOLLER ADRIANO, jun., 28 2016 6:07 PM - 3 respostas
Conecte-se…
BOLLER ADRIANO
#1
Membro registado
3.698 mensagems
Popularité : +175 (223 votes)
Publicado em junho, 28 2016 - 6:07 PM
Exemplo:
Les codes free de FreeDev
[
WinDev
]
[
20
]
Exemple de désérialisation d
'
un
objet
JSON multi
-
niveaux
(
imbrication de niveaux
)
.
s
Json2 est une
chaîne
ANSI
= [
{
"messageId": "56f4c16e-b874-46b6-a548-09ec027bb6cf",
"from": "admin",
"creationUtcDate": "2015-04-06T12:02:48.56Z",
"who": {
"support": {
"status": 4,
"utcDate": "2015-04-06T20:44:21.643"
},
"technic": {
"status": 3,
"utcDate": "2015-04-06T20:44:21.656"
}
}
}
]
st
MsgStamp est une
structure
status est un
entier
utcDate est une
chaîne
FIN
who est une
structure
support est un
st
MsgStamp
technic est un
st
MsgStamp
FIN
st
Msg2 est une
structure
messageId est une
chaîne
from est une
chaîne
creationUtcDate est une
chaîne
who est un who
FIN
oMsg2 est un
st
Msg2
Désérialise
(
oMsg2
,
s
Json2
,
psdJSON
)
--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Denunciar
0
1
BOLLER
#2
Membro registado
3.698 mensagems
Popularité : +175 (223 votes)
Publicado em agosto, 11 2017 - 2:18 PM
//-- le o arquivo Json anexado ao projeto --//
gs
PerguntasJson
is ANSI string
=
fLoadText
(
fDataDir
(
)
+
"/questoes.json"
)
gs
PerguntasJson
=
UTF8ToAnsi
(
gs
PerguntasJson
)
//info(gsPerguntasJson)
//-----------------------------------------------------------------------------------------//
//-- agora coloca os dados em um array apos ler a estrrutura e grava na tabela Perguntas --//
//-----------------------------------------------------------------------------------------//
//--estrutura do Json
JsonStru
is structure
pergunta
is ANSI string
resp_a
is ANSI string
resp_b
is ANSI string
resp_c
is ANSI string
resp_d
is ANSI string
resp_e
is ANSI string
resp_f
is ANSI string
resp_g
is ANSI string
resposta
is ANSI string
explicacao
is ANSI string
END
gst
DadosJson
is array of
JsonStru
Deserialize
(
gst
DadosJson
,
gs
PerguntasJson
,
psdJSON
)
//Info( ArrayCount(gstDadosJson))
//Info( gstDadosJson[1].pergunta )
FOR
E
ACH
st
_linha_json OF
gst
DadosJson
Info
(
st
_linha_json.explicacao
)
END
--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Denunciar
0
1
Willian Fernando
#3
Membro registado
123 mensagems
Popularité : +46 (46 votes)
Publicado em agosto, 18 2017 - 3:32 PM
Sempre é legal da creditos a quem fez/ajudou ou até mesmo desenvolveu o código, no caso acima eu fiz boa parte do mesmo, com as correções necesarias, inclusive teve outro membro que também colaborou nisso
--
Atte. Willian Fernando
Denunciar
0
0
BOLLER
#4
Membro registado
3.698 mensagems
Popularité : +175 (223 votes)
Publicado em agosto, 18 2017 - 5:10 PM
ok
--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Denunciar
0
0
→ Voltar para WINDEV 25
WINDEV 25
Français
English
Español
Portuguesa
Fermer cette fenêtre
Tipo de Pesquisa
Apenas tópicos
Todas as mensagens
Período de pesquisa
Qualquer momento
Última hora
Últimas 24 horas
Semana passada
Mês passado
Ano passado
Cancelar
Pré-visualização da sua mensagem
Adicionar imagem
Importar uma imagem de uma URL
Enviar uma imagem a partir do seu disco
Deixe um ficheiro ou clique em "Procurar ..."
ou
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto