Skip to content

quadrate-language/json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json

JSON parsing module for Quadrate.

Installation

quadpm install json

Usage

use json

fn main() {
    '{"name": "Alice", "age": 30}' -> data
    data "name" json::get_string -> name
    data "age" json::get_int -> age
    name print nl
    age print nl
}

Functions

  • get_string(json:str key:str -- value:str found:bool) - Get string value by key
  • get_int(json:str key:str -- value:int found:bool) - Get integer value by key
  • get_bool(json:str key:str -- value:bool found:bool) - Get boolean value by key
  • has_key(json:str key:str -- found:bool) - Check if key exists
  • get_type(json:str key:str -- type:str) - Get type of value ("string", "number", "bool", "array", "object", "null")
  • array_len(json:str -- len:int) - Get length of JSON array
  • array_get(json:str index:int -- value:str) - Get array element by index

License

MIT

About

Quadrate JSON

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published