That function decodes unicode entities in case it can be of help
-----------------------------------------------------------------
FUNCTION _FFWK_DecodeUnicodeEntities
LPARAMETERS tcString
LOCAL lcResultString, lnPosicion, lcChar, lcTokenString
m.lcResultString = m.tcString
DO WHILE .T.
m.lnPosicion = AT( "\u", m.lcResultString, 1 )
IF m.lnPosicion = 0
EXIT
ENDIF
m.lcTokenString = SUBSTR( m.lcResultString, m.lnPosicion, 6 )
IF LOWER(m.lcTokenString) = "\u20ac"
m.lcChar = "€"
ELSE
TRY
m.lcChar = CHR( EVALUATE( "0x" + SUBSTR(
m.lcResultString, m.lnPosicion + 2, 4) ) )
CATCH
m.lcChar = ""
ENDTRY
ENDIF
m.lcResultString = STRTRAN( m.lcResultString , m.lcTokenString,
m.lcChar )
ENDDO
RETURN m.lcResultString
ENDFUNC
------------------------------------
Jose Enrique Llopis
------------------------------------
-----Mensaje original-----
De: ProFox [mailto:[email protected]] En nombre de Paul Newton
Enviado el: viernes, 16 de noviembre de 2018 12:50
Para: '[email protected]'
Asunto: JSON for Visual FoxPro
Hi all
This is on Craig Boyd's Sweet Potato Software site
(https://tinyurl.com/ybk97s97) but the download link is coming up 404. Any
ideas where I can get hold of it?
Or alternative VFP options to handle JSON? I have tried the following from
various sources (e.g. VFPX, GitHub, CodePlex) :
nfJson-master (Marco Plaza), vfpJson-master (Ignacio Gutiérrez Torrero),
qdfoxjson (Victor Espina)
but none of them can decode JSON strings like this:
"{\"code\":\" ERROR\",\"message\":\"Message
\",\"errors\":[{\"field1\":\"FIELD\",\"value\":\"VALUE\"}]}"
They all appear to stumble because of the additional JSON between the []
brackets. I could StrExtract the string between the [] and decode that
separately but I would rather find something that can handle this directly.
Failing that I'll have to "roll my own".
Thanks
Paul Newton
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/17C95E2F40B14D33AD7EC171FBB711E2@LENOVO1
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.