Fix encoding to json

Julien LepillerTue May 05 00:57:28+0200 2020

148181e

Fix encoding to json

activitystreams/ontology.scm

413413
      ((as-document? doc)
414414
       (as-document->proper-json doc))
415415
      ((list? doc)
416-
       (map
417-
         (match-lambda
418-
           ((key . value)
419-
            (cons
420-
              (if (string? key)
421-
                  key
422-
                  (as-property-uri key))
423-
              (as-value->proper-json value))))
424-
         doc))
416+
       (list->array 1 (map as-value->proper-json doc)))
425417
      ((string? doc)
426418
       doc)
427-
      ((array? doc)
428-
       (list->array 1 (map as-value->proper-json (array->list doc))))
429419
      ((as-typed-value? doc)
430420
       `(("@value" . ,(as-typed-value-value doc))
431421
         ("@type" . ,(as-type-uri (as-typed-value-type doc)))))

activitystreams/predicates.scm

2020
  #:use-module (jsonld json)
2121
  #:use-module (web uri)
2222
  #:export (uri? float? mime-type? date? string-or-lang-string? duration?
23-
            langtag? link-relation? non-negative-integer?))
23+
            langtag? link-relation? non-negative-integer? time? date-time?))
2424
2525
(define (uri? s)
2626
  (and (string? s) (string->uri s)))

4949
5050
(define (non-negative-integer? s)
5151
  (and (number? s) (>= s 0)))
52+
53+
(define (time? s)
54+
  (string? s))
55+
56+
(define (date-time? s)
57+
  (string? s))