koldev / jsonparser Goto Github PK
View Code? Open in Web Editor NEWRecursive descent JSON parser for PascalScript
Recursive descent JSON parser for PascalScript
I want to parse the JSON Input in AMPSCript code using Guide Template Language in Email Template. I have tried using AMPSCript code:
var @JSON
set @JSON =
'{
"ArticleCount":22,
"Articles":[
{
"ArticleAbstractTeaser":null,
"ArticleActiveDate":null,
"Authors":[
{
"AuthorTypeId":1,
"CorrespondenceInformation":null
}
],
"Blurb":null,
"CmeUrls":[
],
"Links":[
{
"Description":null,
"LinkType":"jumplink"
},
{
"Description":null,
"LinkType":"figure"
},
{
"Description":"null",
"LinkType":"figure"
}
],
"Ordinal":0,
"PdfOnlyMessage":"",
"Topics":[
{
"Score":0,
"Topic":"ISSUE @ A GLANCE"
}
],
"UserHasAccess":false,
"VideoMultimediaUrlResponse":null
}
]
}'
{{.datasource JSONVar type=variable maxrows=20}}
{{.data}}
{ "target" : "@JSON" }
{{/data}}
ArticleCount: {{ArticleCount}}
{{.datasource Articles type=nested maxrows=20}}
{{.data}}
{ "target" : "JsonVar.Articles" }
{{/data}}
ArticleAbstractTeaser: {{ArticleAbstractTeaser}}
ArticleActiveDate: {{ArticleActiveDate}}
{{.datasource Authors type=nested maxrows=20}}
{{.data}}
{ "target" : "Articles.Authors" }
{{/data}}
{{/datasource}}
{{/datasource}}
{{/datasource}}
But it is not working, please anyone help me for JSON Parsing.
Function String_
fills in internal SpecChar
, but doesn't append it to the result.
This means that escaped backslashes simply won't appear for example. After the case, the function needs a Result := Result + SpecChar
for parsing to work correctly;
Hello, i'm trying to compile a test installer just to test processing of a json file, but while running the command "ISCC.exe json.example.installer.iss" i'm getting the error "JsonParser.pas: Unrecognized parameter name "type" Compile aborted." and i don´t know what exactly am i doing wrong. Not an expert on InnoSetup nor PascalScript. Can you point me to the right direction please?
json.example.installer.iss.txt
I am calling this library from Inno Setup 6.0.2
The following json string result in memory access violations for me:
'{ "a": {"b": [ ] }, "d": "e"}'
I was able to fix this by making the following changes to the Value
function:
Line 287:
var
N: Integer;
O: TJsonObject;
A: TJsonArray;
Line 324:
A := Array_(JsonParser, @Value);
JsonParser.Output.Arrays[N] := A;
Line 333:
O := Object_(JsonParser, @Value);
JsonParser.Output.Objects[N] := O;
@koldev Could you confirm this problem and fix?
Json parsing with UTF-8 encoding works fine with Identifier 65001.
But fails when the JSON file's encoding is UTF-8 with BOM.
Can anyone help me how to go ahead with UTF-8 with BOM encoding or do I need to use any other identifier rather than 65001.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.