123456789101112131415161718192021 |
- ;; This is a program to pretty-print json, like python -m json.tool
- (import (scheme base)
- (scheme write)
- (scheme process-context)
- (macduffie json))
- (define (read-all)
- (let loop ((l '()))
- (define next-char (read-char))
- (if (eof-object? next-char)
- (list->string (reverse l))
- (loop (cons next-char l)))))
- (define (main-proc args)
- (if (null? args)
- (display (json-write-string (json-read-string (read-all)) #t #\space 4))
- (display (json-write-string (json-read-string (read-all)) #t))))
- (main-proc (cdr (command-line)))
|