wen....@gmail.com
unread,Oct 4, 2025, 6:44:48 AM (5 days ago) Oct 4Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to harbou...@googlegroups.com
sample prg:
func main()
local hData := {"err_no"=>-1,"errmsg"=>"無法辨識的功能!!","errtil"=>"錯誤!!(3bc8d2ca-a101-4585-afae-a35d483c0796)"}
// local cJson := hb_jsonEncode( hData ) // <--- is ok
local cJson := '{"err_no"=>-1,"errmsg"=>"無法辨識的功能!!","errtil"=>"錯誤!!(3bc8d2ca-a101-4585-afae-a35d483c0796)"}' // is fail!!
local hJson := {=>}, i
? 'json string-1: ',cJson
hJson := hb_jsonDecode( cJson )
aJson := hb_hKeys(hJson)
? 'json len: ', Len(aJson)
FOR i := 1 TO Len(aJson)
? i,':',hb_hKeyAt( hJson, i ), '=>', hb_hValueAt( hJson, i )
NEXT i
//
? 'json string-2: ',cJson
// cJson := hb_StrReplace( cJson, {'\'}, {'\\'} )
hJson := hb_jsonDecode( cJson )
aJson := hb_hKeys(hJson)
? 'json len: ', Len(aJson)
FOR i := 1 TO Len(aJson)
? i,':',hb_hKeyAt( hJson, i ), '=>', hb_hValueAt( hJson, i )
NEXT i
return