Skip to content
⌘ NSIS Forum Archive

read json without nsjson

10 posts

Anders#
NSIS does not have native JSON support, you are stuck with the plug-in.

If the file is really small and simple you might be able to use the NSIS file and string instructions but I don't really recommend it.
shekara#
I am sorry for the basic questions. I have this in my json file
{
"BLD_BRH" : "****",
"RLS_STR" : "****",
"RLS_FIXED" :
}
i am setting this nsJSON::Set /file $EXEDIR\manifest.json . but I just need to read BLD_BRH and RLS_FIXED. I don't see anything here in examples
Anders#
Section
InitPluginsdir
FileOpen $0 "$PluginsDir\temp.txt" w
FileWrite $0 '{"BLD_BRH" : "1234","RLS_STR" : "5678","RLS_FIXED" : "invalid example"}'
FileClose $0
nsJSON::Set /file "$PluginsDir\temp.txt"
nsJSON::Get "BLD_BRH" /end
Pop $0
MessageBox mb_ok $0
SectionEnd 
shekara#
I don't want to write anything. there is already a file that I just need to read.

{
"BLD_BRH" : "****",
"RLS_STR" : "****",
"RLS_DFT" : [
[

],

],
"RLS_FIXED" :"***",
}

Section
ClearErrors
Push $0
nsJSON::Set /file "$EXEDIR\eg.json"

nsJSON::Get "RLS_STR" /end
Pop $0
MessageBox mb_ok $0
SectionEnd

it shows blank