<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged parsing</title>
<link>https://ask.clojure.org/index.php/tag/parsing</link>
<description></description>
<item>
<title>clojure.edn parser will not parse complete file in some cases</title>
<link>https://ask.clojure.org/index.php/14537/clojure-edn-parser-will-not-parse-complete-file-in-some-cases</link>
<description>&lt;p&gt;I've noticed that &lt;code&gt;clojure.edn&lt;/code&gt; parser will skip rest of the file if it manages to find the first valid token that will complete collection. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; demo.edn
{
 :foo 1
 :bar 2 }
 :baz 3 
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[clojure.edn :as edn]
         '[clojure.java.io :as io])

(with-open [r (io/reader &quot;demo.edn&quot;)]
  (edn/read (java.io.PushbackReader. r)))

user=&amp;gt; {:foo 1, :bar 2}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It will also ignore rest of the file when the file is clearly malformed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{
 :foo 1
 :bar 2 }
xxxx yyyy }}}}} {{{{ ((
 :baz 3 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it returns again:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; {:foo 1, :bar 2}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I was expecting it to throw EOF exception or at least '}' mismatch. Is this behavior by design or a possible bug?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14537/clojure-edn-parser-will-not-parse-complete-file-in-some-cases</guid>
<pubDate>Wed, 07 May 2025 12:29:34 +0000</pubDate>
</item>
<item>
<title>Support Clojure 1.12-alpha12 Array class notation</title>
<link>https://ask.clojure.org/index.php/13906/support-clojure-1-12-alpha12-array-class-notation</link>
<description>&lt;p&gt;Currently, the function &lt;code&gt;clojure.tools.reader.impl.commons/parse-symbol&lt;/code&gt; is fairly lax with what it allows, both in general and with regard to the forthcoming Clojure 1.12 Array class notation.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (mapv trc/parse-symbol [&quot;String/1&quot; &quot;String/-1&quot; &quot;String/11&quot; &quot;String/1a&quot;])
[nil [&quot;String&quot; &quot;-1&quot;] nil nil]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is different than the current implementation, which only accepts the first. Is there any interest in updating it to be stricter for the new notation?&lt;/p&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13906/support-clojure-1-12-alpha12-array-class-notation</guid>
<pubDate>Thu, 23 May 2024 19:02:29 +0000</pubDate>
</item>
<item>
<title>Is the standard JSON parser broken ?</title>
<link>https://ask.clojure.org/index.php/8860/is-the-standard-json-parser-broken</link>
<description>&lt;p&gt;It seems that the &quot;standard&quot; json parser is happily parsing invalid json as shown below&lt;br&gt;
&lt;code&gt;user=&amp;gt; (require '[clojure.data.json :as j])
nil
user=&amp;gt; (j/read-str &quot;{\&quot;a\&quot;: 123,,}&quot;)
{&quot;a&quot; 123}
user=&amp;gt; (j/read-str &quot;{\&quot;a\&quot;: 123,\&quot;b\&quot;,}&quot;)
{&quot;a&quot; 123}&lt;/code&gt;&lt;br&gt;
I know other libraries exist (eg jsonista, cheshire) but it doesn't look good that what seems to be the &quot;standard&quot; json parser (as per the link on &lt;a rel=&quot;nofollow&quot; href=&quot;http://json.org/&quot;&gt;http://json.org/&lt;/a&gt; and the fact that it lives inside the main clojure github org) is broken.&lt;/p&gt;
&lt;p&gt;(Logged as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/DJSON-29&quot;&gt;https://clojure.atlassian.net/browse/DJSON-29&lt;/a&gt;)&lt;/p&gt;
</description>
<category>data.json</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8860/is-the-standard-json-parser-broken</guid>
<pubDate>Mon, 18 Nov 2019 16:41:29 +0000</pubDate>
</item>
</channel>
</rss>