Eliminei a criação do json do fonte, usando resource:
STATIC FUNCTION JasonList()
#pragma __binarystreaminclude "resource/remote.json" | RETURN %s
É com minha função de achoice fiz o resto.
#include "inkey.ch"
PROCEDURE pTesRemSony
LOCAL cTxt, aHash, aList, nOpc
LOCAL oAparelho, nOpcAparelho
LOCAL oFabricante, nOpcFabricante
LOCAL oCode
cTxt := JasonList()
aHash := hb_jsonDecode( cTxt )
DO WHILE .T.
Cls()
aList := {}
FOR EACH oAparelho IN aHash[ "devices" ]
AAdd( aList, oAparelho[ "device" ] )
NEXT
wAchoiceNoClose( 1, 1, aList,@nOpcAparelho, "Device" )
IF Lastkey() == K_ESC
EXIT
ENDIF
DO WHILE .T.
@ 0, 60 CLEAR TO MaxRow(), MaxCol()
aList := {}
FOR EACH oFabricante IN aHash[ "devices" ][ nOpcAparelho ][ "brandCodes" ]
AAdd( aList, oFabricante[ "brand" ] )
NEXT
wAchoiceNoClose( 5, 30, aList, @nOpcFabricante, "brand" )
IF LastKey() == K_ESC
EXIT
ENDIF
aList := {}
FOR EACH oCode IN aHash[ "devices" ][ nOpcAparelho ][ "brandCodes" ][ nOpcFabricante][ "codes" ]
AAdd( aList, oCode )
NEXT
wAchoice( 10, 60, aList, @nOpc, "brandcodes" )
( nOpc )
Inkey(0)
wClose()
ENDDO
wClose()
ENDDO
RETURN
STATIC FUNCTION JasonList()
#pragma __binarystreaminclude "resource/remote.json" | RETURN %s
Conclusão interessante:
Dá pra aproveitar o arquivo json pra economizar fonte PRG, como as IDEs fazem.
Sei não... possibilidades se mutiplicando.... ainda mais podendo salvar no MySQL...
Assim vou começar a gostar de variável hash.....