Skip to content

clojure.core/read-string

View this page on ClojureDocs

Type: function Added: Clojure 1.0 Examples: 11 Runnable: 4
([s] [opts s])

Reads one object from the string s. Optionally include reader options, as specified in read.

Note that read-string can execute code (controlled by read-eval), and as such should be used only with trusted sources.

For data structure interop use clojure.edn/read-string

Examples

by gstamp on . May have evaluation errors.
by boxie on
by benjiiiiii on
by devn on . May have evaluation errors.
by dansalmo on . May have evaluation errors.
by dansalmo on . May have evaluation errors.
by jafingerhut on
by one-finger on
by loeschzwerg on . May have evaluation errors.
by adanhawth on . May have evaluation errors.
by ertugrulcetin on . May have evaluation errors.

Note by boxie

read-string is useful for running clojure code from a script or translator.

Note by bfontaine

Never EVER use read-string on data from an untrusted source. Prefer clojure.edn/read-string to parse EDN. The former can execute arbitrary code, including calling external URLs or reading/writing/erasing files.

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.