FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV Mobile 2024
→
Désérialisation JSON Windev Mobile 19
Désérialisation JSON Windev Mobile 19
Débuté par Fred, 12 déc. 2013 15:56 - 4 réponses
Connectez-vous…
Fred
#1
Posté le 12 décembre 2013 - 15:56
Bonjour,
Est-ce que quelqu'un à réussi a désérialisé du JSON avec Windev mobile 19.
J'ai l'impression que c'est n'est pas compatible sous Android (l'aide en ligne est vague sur le sujet et n'indique que la désérialisation binaire comme incompatible.
=====
Je cherche a transformer ça vers un tableau de structure
http://maps.google.com/maps/api/geocode/json…
Cdlt,
Frédéric
Signaler
0
0
adrianoboller
#2
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 12 décembre 2014 - 14:58
// Life Tech 29/10/2014
// Summary: converte a sequencia Escape '\' usada em Json para Ansi
// Syntax:
//[ <Result> = ] JsonToAnsi (<TextoJson>)
//
// Parameters:
//
TextoJson: texto Json
// Return Value:
//
UNICODE string:
// texto Ansi
Procedure
JsonToAnsi
(
TextoJson
)
res is
string
iniciouString is
boolean
i is
int
=
1
LOOP
IF
i
>
Length
(
TextoJson
)
THEN BREAK
IF
TextoJson
[
[i]
]
=
""
""
THEN
iniciouString
=
1
-
iniciouString
;
res
+
=
""
""
;
i
+
+
ELSE
IF
iniciouString
THEN
// dentro do "string"
IF
TextoJson
[
[i]
]
=
"\"
AND
i
<
Length
(
TextoJson
)
THEN
// dentro da sequencia Escape "\"
SWITCH
TextoJson
[
[i+
1
]
]
CASE
""
""
:
res
+
=
""
""
;
i
+
=
2
// quotation mark
CASE
"\"
:
res
+
=
"\"
;
i
+
=
2
// reverse solidus
CASE
"/"
:
res
+
=
"/"
;
i
+
=
2
// solidus
CASE
"b"
:
res
+
=
"<"
;
i
+
=
2
// backspace
CASE
"f"
:
res
+
=
CR
+
CR
;
i
+
=
2
// formfeed
CASE
"n"
:
res
+
=
CR
;
i
+
=
2
// new line
CASE
"r"
:
res
+
=
CR
;
i
+
=
2
// carriage return
CASE
"t"
:
res
+
=
TAB
;
i
+
=
2
// horizontal Tab
CASE
"u"
:
// hexadecimal digits \u1234
IF
i
+
5
<
=
Length
(
TextoJson
)
THEN
res
+
=
Charact
(
HexaToInt
(
TextoJson
[
[i+
2
TO i
+
5
]
]
)
)
i
+
=
6
END
OTHER
CASE
res
+
=
TextoJson
[
[i]
]
;
i
+
+
END
ELSE
// fora da sequencia Escape "\"
res
+
=
TextoJson
[
[i]
]
;
i
+
+
END
ELSE
// fora do "string"
res
+
=
TextoJson
[
[i]
]
;
i
+
+
END
END
END
RESULT
res
Signaler
0
0
adrianoboller
#3
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 12 décembre 2014 - 15:10
JSONTOVARIANT
Signaler
0
0
adrianoboller
#4
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 12 décembre 2014 - 15:11
Trace(VariantToJSON(Person))
Signaler
0
0
BOLLER
#5
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 11 août 2017 - 14:17
//-- 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/
Signaler
0
0
→ Revenir à WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
WEBDEV (précédentes versions)
WINDEV Mobile (précédentes versions)
Etats & Requêtes
Hors-sujet
Outils
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte