[ZScript] JSON Parser - Now with prefixes!

Post your example zscripts/ACS scripts/etc here.

[ZScript] JSON Parser - Now with prefixes!

Postby RicardoLuis0 » Tue Sep 14, 2021 12:13 pm

This is a simple JSON parser for ZScript, supports trailing commas and single/multi-line comments.

Includes a usage example and a small test suite.

To use in your mod, just generate the prefixes, copy over the generated/ZJSON folder, and add #include "ZJSON/Include.zs" to your main ZScript file.

Check it out on GitHub

Generating Prefixes:

Run generate.sh [your prefix] on linux/wsl/msys/cygwin. The prefixed files will be in the generated folder.

Types:
Spoiler:

How to Use:
Call JSON.parse with a string that contains JSON text, it will return either a JsonElement in case of success, or a JsonError in case of failure.
Last edited by RicardoLuis0 on Mon Sep 27, 2021 9:01 am, edited 2 times in total.
RicardoLuis0
 
Joined: 21 Aug 2018
Location: Brazil
Discord: RicardoLuis0#1862
Github ID: RicardoLuis0
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: [ZScript] JSON Parser

Postby Apeirogon » Tue Sep 14, 2021 12:33 pm

Add readme and license to the repo please.
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: [ZScript] JSON Parser

Postby RicardoLuis0 » Tue Sep 14, 2021 12:41 pm

Apeirogon wrote:Add readme and license to the repo please.

sure, i'll add a readme, but regarding license, it has had a license since the start: MIT
RicardoLuis0
 
Joined: 21 Aug 2018
Location: Brazil
Discord: RicardoLuis0#1862
Github ID: RicardoLuis0
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: [ZScript] JSON Parser

Postby Apeirogon » Tue Sep 14, 2021 12:44 pm

Note to self, dont surf internet with beer in hand.
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: [ZScript] JSON Parser

Postby Nash » Tue Sep 14, 2021 5:02 pm

Very nice! Been wanting one for quite some time and here it is. :D Thanks so much for doing this!
User avatar
Nash
Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes


Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests