PigJSonLib 1.3.5.6
Suggested Alternatives
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PigJSonLib --version 1.3.5.6
NuGet\Install-Package PigJSonLib -Version 1.3.5.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PigJSonLib" Version="1.3.5.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PigJSonLib --version 1.3.5.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PigJSonLib, 1.3.5.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PigJSonLib as a Cake Addin #addin nuget:?package=PigJSonLib&version=1.3.5.6 // Install PigJSonLib as a Cake Tool #tool nuget:?package=PigJSonLib&version=1.3.5.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PigJSon VB.net Sample code
Parse JSon Sample code
pjParse = New PigJSon("{""SayInf"":""Hello World""}")
If pjParse.LastErr = "" Then
Debug.Print(pjParse.GetStrValue("SayInf"))
End If
Return results
Hello World
Simple text elements Sample code
pjAssemble = New PigJSon
With pjAssemble
.AddEle("SiteName", "Seow Phong Web Site", True) 'The first element needs to be explicitly specified
.AddEle("SiteUrl", "http://www.seowphong.com") 'The default is not the first element
.AddEle("Describe", "A website for free software" & vbCrLf & " and shareware") 'The text contains a carriage return
.AddSymbol(PigJSon.xpSymbolType.EleEndFlag)
If .ParseJSON() = "OK" Then
Debug.Print(.MainJSonStr)
Debug.Print(.GetStrValue("SiteName"))
Debug.Print(.GetStrValue("SiteUrl"))
Debug.Print(.GetStrValue("Describe"))
End If
End With
Return results
{"SiteName":"Seow Phong Web Site","SiteUrl":"http://www.seowphong.com","Describe":"A website for free software\r\n and shareware"}
Seow Phong Web Site
http://www.seowphong.com
A website for free software
and shareware
Simple multiple data types elements Sample code
pjAssemble = New PigJSon
With pjAssemble
.AddEle("SiteName", "Seow Phong Web Site", True) 'The first element needs to be explicitly specified
.AddEle("SiteUrl", "http://www.seowphong.com") 'The default is not the first element
.AddEle("Describe", "A website for free software" & vbCrLf & " and shareware") 'The text contains a carriage return
.AddEle("Rank", 168)
.AddEle("VisitPerDay", CDec(168.88))
.AddEle("VisitTimeStr", "8/8/2020")
.AddEle("VisitTime", Now)
.AddSymbol(PigJSon.xpSymbolType.EleEndFlag)
If .ParseJSON() = "OK" Then
Debug.Print(.MainJSonStr)
Debug.Print(.GetStrValue("SiteName"))
Debug.Print(.GetStrValue("SiteUrl"))
Debug.Print(.GetStrValue("Describe"))
Debug.Print(.GetIntValue("Rank").ToString)
Debug.Print(.GetDecValue("VisitPerDay").ToString)
Debug.Print(.GetStrValue("VisitTimeStr"))
Debug.Print(.GetDateValue("VisitTime").ToString)
Debug.Print(.GetDateValue("VisitTime", True).ToString)
End If
End With
Return results
{"SiteName":"Seow Phong Web Site","SiteUrl":"http://www.seowphong.com","Describe":"A website for free software\r\n and shareware","Rank":"168","VisitPerDay":"168.88","VisitTimeStr":"8/8/2020","VisitTime":"1601242412742"}
Seow Phong Web Site
http://www.seowphong.com
A website for free software
and shareware
168
168.88
8/8/2020
2020/9/27 13:33:32
2020/9/27 21:33:32
Simple array elements Sample code
pjArray = New PigJSon
With pjArray
'In this way, the content of the array element will be escaped.
.AddEle("", "Google", True)
.AddEle("", "GitHub")
.AddEle("", "Apache")
End With
pjAssemble = New PigJSon
With pjAssemble
.AddEle("TotalSites", 3, True)
.AddOneArrayEle("SitesList", pjArray.MainJSonStr)
.AddSymbol(PigJSon.xpSymbolType.EleEndFlag)
If .ParseJSON() = "OK" Then
Debug.Print(.MainJSonStr)
Debug.Print(.GetIntValue("TotalSites").ToString)
Debug.Print(.GetStrValue("SitesList[0]"))
Debug.Print(.GetStrValue("SitesList[1]"))
Debug.Print(.GetStrValue("SitesList[2]"))
End If
End With
Return results
{"TotalSites":"3","SitesList":["Google","GitHub","Apache"]}
3
Google
GitHub
Apache
Return results
{"TotalSites":"3","SitesList":["Google","GitHub","Apache"]}
3
Google
GitHub
Apache
complex array elements Sample code
pjOneCompany = New PigJSon
pjArray = New PigJSon
pjAssemble = New PigJSon
With pjAssemble
.AddEle("Name", "Company products", True)
.AddArrayEleBegin("CompanyProductList")
With pjArray
.Reset()
.AddEle("", "Windows", True)
.AddEle("", "SQL Server")
.AddEle("", "Office")
.AddEle("", "Azure")
End With
With pjOneCompany
.Reset()
.AddOneArrayEle("ProductList", pjArray.MainJSonStr, True)
.AddEle("CompanyName", "Microsoft")
.AddSymbol(PigJSon.xpSymbolType.EleEndFlag)
End With
.AddArrayEleValue(pjOneCompany.MainJSonStr, True)
With pjArray
.Reset()
.AddEle("", "Chrome", True)
.AddEle("", "YouTube")
.AddEle("", "Android")
End With
With pjOneCompany
.Reset()
.AddEle("CompanyName", "Google", True)
.AddOneArrayEle("ProductList", pjArray.MainJSonStr)
.AddSymbol(PigJSon.xpSymbolType.EleEndFlag)
End With
.AddArrayEleValue(pjOneCompany.MainJSonStr)
.AddSymbol(PigJSon.xpSymbolType.ArrayEndFlag)
.AddEle("TotalCompanies", 2)
.AddSymbol(PigJSon.xpSymbolType.EleEndFlag)
If .ParseJSON() = "OK" Then
Debug.Print(.MainJSonStr)
Debug.Print(.GetStrValue("Name"))
Debug.Print(.GetIntValue("TotalCompanies").ToString)
Debug.Print(.GetStrValue("CompanyProductList[0].CompanyName"))
Debug.Print(.GetStrValue("CompanyProductList[0].ProductList[2]"))
Debug.Print(.GetStrValue("CompanyProductList[0].ProductList[3]"))
Debug.Print(.GetStrValue("CompanyProductList[1].CompanyName"))
Debug.Print(.GetStrValue("CompanyProductList[1].ProductList[1]"))
Debug.Print(.GetStrValue("CompanyProductList[1].ProductList[2]"))
End If
End With
Return results
{"Name":"Company products","CompanyProductList":[{"ProductList":["Windows","SQL Server","Office","Azure"],"CompanyName":"Microsoft"},{"CompanyName":"Google","ProductList":["Chrome","YouTube","Android"]}],"TotalCompanies":"2"}
Company products
2
Microsoft
Office
Azure
Google
YouTube
Android
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net20 is compatible. net30 is compatible. net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 2.0
- No dependencies.
-
.NETFramework 3.0
- No dependencies.
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fix bugs for ParseJSON, add UnlockEndSymbol for insert JSon item.