Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ante-json

Vibe-coded JSON library

Written in ante

Example

text = "{\"id\":9007199254740993,\"name\":\"ante\"}"

// parse

match jd_parse (bs_from_string (ref text)) (parse_opts_default ())
| Error e ->
    (line, col) = jsonerr_line_col (bs_from_string (ref text)) (err_offset (ref e))
    println "parse failed at line ${line}, column ${col}"
| Ok (doc, root) ->
    if jd_tag (ref doc) root == jt_obj () then
        match jd_obj_get (ref doc) root (ref "id")
        | None -> println "no id"
        | Some id -> println "id ${id}"

    // serialize

    match jd_ser (ref doc) root
    | Error _ -> println "not serializable"
    | Ok out -> println out

(drop calls omitted for brevity)

About

Vibe-coded JSON library

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages