Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

31
Task/JSON/OCaml/json-2.ml Normal file
View file

@ -0,0 +1,31 @@
open Yojson.Basic.Util
let s = "
{ \"name\": \"John Doe\",
\"pages\": [
{ \"id\": 1,
\"title\": \"The Art of Flipping Coins\",
\"url\": \"http://example.com/398eb027/1\"
},
{ \"id\": 2, \"deleted\": true },
{ \"id\": 3,
\"title\": \"Artichoke Salad\",
\"url\": \"http://example.com/398eb027/3\"
},
{ \"id\": 4,
\"title\": \"Flying Bananas\",
\"url\": \"http://example.com/398eb027/4\"
}
]
}"
let extract_titles json =
[json]
|> filter_member "pages"
|> flatten
|> filter_member "title"
|> filter_string
let () =
let json = Yojson.Basic.from_string s in
List.iter print_endline (extract_titles json)