custom json parsing
This commit is contained in:
parent
838b9bf5f1
commit
d536380b51
@ -55,18 +55,19 @@
|
||||
|
||||
(define (get-parking-lots)
|
||||
(let ((result (simple-json-request (string-append "http://parkering.linkoping.se/Parkeringsdata/ParkeringsdataV1.svc/GetParkeringsYtaList/" parking-key "/0"))))
|
||||
(vector->list (value 'ParkingAreaNewList result))))
|
||||
(value 'ParkingAreaNewList result)))
|
||||
|
||||
(define (computerized? lot)
|
||||
(has-key? 'ParkingSpacesAvailable lot))
|
||||
|
||||
(define (only-has-handicap-spots? lot)
|
||||
(equal? #(4) (value 'ParkingTypes lot)))
|
||||
(equal? '(4) (value 'ParkingTypes lot)))
|
||||
|
||||
(define (electric-car-lot? lot)
|
||||
(member? 3 (value 'ParkingTypes lot)))
|
||||
|
||||
(define (main)
|
||||
(json-parsers (cons `(array . ,identity) (json-parsers)))
|
||||
(display-newline "Parking spaces available:")
|
||||
(let ((lots (sort-via string-ci<? (curry value 'Name) (get-parking-lots))))
|
||||
(map (compose display-newline (curry format-assoc '(Name ": " ParkingSpacesAvailable "/" ParkingSpaces)))
|
||||
|
Loading…
Reference in New Issue
Block a user