Skip to content

can deserialize a Set, but can't serialize a Set #11

@trevor

Description

@trevor
;; works:

(def typed-data-yaml "
the-bin: !!binary 0101")

(clj-yaml.core/parse-string typed-data-yaml)
;= {:the-bin #<byte[] [B@61911e64>}

(clj-yaml.core/generate-string
  (clj-yaml.core/parse-string typed-data-yaml)
  :dumper-options {:flow-style :block})
;= "the-bin: !!binary |-\n  0101\n"


;; generate-string creates a sequence instead of a set:

(def set-yaml "
--- !!set
? Mark McGwire
? Sammy Sosa
? Ken Griff")

(clj-yaml.core/parse-string set-yaml)
;= #{"Mark McGwire" "Ken Griff" "Sammy Sosa"}

(clj-yaml.core/generate-string
  (clj-yaml.core/parse-string set-yaml)
  :dumper-options {:flow-style :block})
;= "- Mark McGwire\n- Ken Griff\n- Sammy Sosa\n"

(clj-yaml.core/parse-string
  (clj-yaml.core/generate-string
    (clj-yaml.core/parse-string set-yaml)
    :dumper-options {:flow-style :block}))
;= ("Mark McGwire" "Ken Griff" "Sammy Sosa")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions