Skip to content
/ Jason Public

Jason is yet another JSON parsing library :).

Notifications You must be signed in to change notification settings

Gabology/Jason

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Jason

Jason is yet another JSON parsing library :).

Usage

JSON can be parsed through the mappedJson computation expression or through the use of the infix operators.

Using computation expressions

type Person =
    { Name    : string
      Age     : int
      Married : bool }

let json =
    """{
        "name": "John",
        "age": 30,
        "married": true 
        } """
    |> JsonValue.Parse

mappedJson { let! name = json.Read "name"
             let! age = json.Read "age"
             let! married = json.Read "married"
             return { Name = name
                      Age = age
                      Married = married } }

val it : MappedJson<Person> = Success {Name = "John";
                                       Age = 30;
                                       Married = true;}
  

Using infix operators

type Person =
    { Name    : string
      Age     : int
      Married : bool }
    static member Create name age married =
        { Name = name; Age = age; Married = married }

Person.Create
<!> json2.Read "name"
<*> json2.Read "age"
<*> json2.Read "married"

val it : MappedJson<Person> = Success {Name = "John";
                                       Age = 30;
                                       Married = true;}

About

Jason is yet another JSON parsing library :).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages