Sanchime.Json/Program.fs

29 lines
623 B
Forth

open Sanchime.Json
open Sanchime.Json.Parser
let json = """
{
"Name": "Bob",
"Email": "bob@example.com",
"IsActive": true,
"Info": {
"Age": 18,
"Gender": "男",
"Address": "江西",
"City": "赣州",
"Record": [
"小学",
"初中",
"高中"
]
}
}
"""
let foo = function
| Object v -> v
| _ -> failwith "其他"
let user = json |> parse
user |> foo |> List.iter (fun a -> printfn $"Name: {fst a}, Value: {snd a}")