mirror of
https://github.com/status-im/NimYAML.git
synced 2025-01-14 13:34:24 +00:00
139 lines
9.4 KiB
HTML
139 lines
9.4 KiB
HTML
<!DOCTYPE html>
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>NimYAML - Module yaml.tojson</title>
|
|
|
|
<link href="docutils.css" rel="stylesheet" type="text/css"/>
|
|
<link href="style.css" rel="stylesheet" type="text/css"/>
|
|
|
|
<link href='http://fonts.googleapis.com/css?family=Raleway:400,600,900' rel='stylesheet' type='text/css'/>
|
|
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
|
</head>
|
|
<body>
|
|
<a href="https://github.com/flyx/NimYAML"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 10;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
|
|
<header>
|
|
<a class="pagetitle" href="index.html">NimYAML</a>
|
|
<a href="index.html">Home</a>
|
|
<a href="testing.html">Testing Ground</a>
|
|
<span>Docs:</span>
|
|
<a href="api.html">Overview</a>
|
|
<span>
|
|
<a href="#">Serialization</a>
|
|
<ul>
|
|
<li><a href="serialization.html">Overview</a></li>
|
|
<li><a href="schema.html">Schema</a></li>
|
|
</ul>
|
|
</span>
|
|
<span>
|
|
<a href="#">Modules</a>
|
|
<ul class="monospace">
|
|
<li><a href="yaml.html">yaml</a></li>
|
|
<li><a href="yaml.dom.html">yaml.dom</a></li>
|
|
<li><a href="yaml.hints.html">yaml.hints</a></li>
|
|
<li><a href="yaml.parser.html">yaml.parser</a></li>
|
|
<li><a href="yaml.presenter.html">yaml.presenter</a></li>
|
|
<li><a href="yaml.serialization.html">yaml.serialization</a></li>
|
|
<li><a href="yaml.stream.html">yaml.stream</a></li>
|
|
<li><a href="yaml.taglib.html">yaml.taglib</a></li>
|
|
<li><a href="yaml.tojson.html">yaml.tojson</a></li>
|
|
</ul>
|
|
</span>
|
|
</header>
|
|
<article id="documentId">
|
|
<div class="container">
|
|
<h1 class="title">Module yaml.tojson</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div>
|
|
Search: <input type="text" id="searchInput"
|
|
onkeyup="search()" />
|
|
</div>
|
|
<div>
|
|
Group by:
|
|
<select onchange="groupBy(this.value)">
|
|
<option value="section">Section</option>
|
|
<option value="type">Type</option>
|
|
</select>
|
|
</div>
|
|
<ul class="simple simple-toc" id="toc-list">
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#constructJson,YamlStream"
|
|
title="constructJson(s: var YamlStream): seq[JsonNode]"><wbr />construct<wbr />Json</a></li>
|
|
<li><a class="reference" href="#loadToJson,Stream"
|
|
title="loadToJson(s: Stream): seq[JsonNode]"><wbr />load<wbr />To<wbr />Json</a></li>
|
|
<li><a class="reference" href="#loadToJson,string"
|
|
title="loadToJson(str: string): seq[JsonNode]"><wbr />load<wbr />To<wbr />Json</a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<div class="nine columns" id="content">
|
|
<div id="tocRoot"></div>
|
|
<p class="module-desc"><p>The tojson API enables you to parser a YAML character stream into the JSON structures provided by Nim's stdlib.</p>
|
|
</p>
|
|
<section id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="json.html">json</a>, <a class="reference external" href="streams.html">streams</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="tables.html">tables</a>, <a class="reference external" href="taglib.html">taglib</a>, <a class="reference external" href="hints.html">hints</a>, <a class="reference external" href="serialization.html">serialization</a>, <a class="reference external" href="stream.html">stream</a>, <a class="reference external" href="../private/internal.html">../private/internal</a>, <a class="reference external" href="parser.html">parser</a>
|
|
</dl></section>
|
|
<section id="12">
|
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
|
<dl class="item">
|
|
<dt id="constructJson"><a name="constructJson,YamlStream"></a><pre><span class="Keyword">proc</span> <span class="Identifier">constructJson</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">YamlStream</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">JsonNode</span><span class="Other">]</span> <span class="Other pragmabegin">{.</span><div class="pragma">
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">YamlConstructionError</span><span class="Other">,</span> <span class="Identifier">YamlStreamError</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span></div><span class="Other pragmaend">.}</span></pre></dt>
|
|
<dd>
|
|
<p>Construct an in-memory JSON tree from a YAML event stream. The stream may not contain any tags apart from those in <tt class="docutils literal"><span class="pre">coreTagLibrary</span></tt>. Anchors and aliases will be resolved. Maps in the input must not contain non-scalars as keys. Each element of the result represents one document in the YAML stream.</p>
|
|
<p><strong>Warning:</strong> The special float values <tt class="docutils literal"><span class="pre">[+-]Inf</span></tt> and <tt class="docutils literal"><span class="pre">NaN</span></tt> will be parsed into Nim's JSON structure without error. However, they cannot be rendered to a JSON character stream, because these values are not part of the JSON specification. Nim's JSON implementation currently does not check for these values and will output invalid JSON when rendering one of these values into a JSON character stream.</p>
|
|
|
|
<a
|
|
href="/yaml/tojson.nim#L79"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
</dd>
|
|
<dt id="loadToJson"><a name="loadToJson,Stream"></a><pre><span class="Keyword">proc</span> <span class="Identifier">loadToJson</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">Stream</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">JsonNode</span><span class="Other">]</span> <span class="Other pragmabegin">{.</span><div class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">YamlParserError</span><span class="Other">,</span>
|
|
<span class="Identifier">YamlConstructionError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span></div><span class="Other pragmaend">.}</span></pre></dt>
|
|
<dd>
|
|
Uses <a class="reference external" href="#YamlParser">YamlParser</a> and <a class="reference external" href="#constructJson">constructJson</a> to construct an in-memory JSON tree from a YAML character stream.
|
|
<a
|
|
href="/yaml/tojson.nim#L179"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
</dd>
|
|
<dt id="loadToJson"><a name="loadToJson,string"></a><pre><span class="Keyword">proc</span> <span class="Identifier">loadToJson</span><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">JsonNode</span><span class="Other">]</span> <span class="Other pragmabegin">{.</span><div class="pragma">
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">YamlParserError</span><span class="Other">,</span> <span class="Identifier">YamlConstructionError</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span></div><span class="Other pragmaend">.}</span></pre></dt>
|
|
<dd>
|
|
Uses <a class="reference external" href="#YamlParser">YamlParser</a> and <a class="reference external" href="#constructJson">constructJson</a> to construct an in-memory JSON tree from a YAML character stream.
|
|
<a
|
|
href="/yaml/tojson.nim#L197"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
</dd>
|
|
|
|
</dl></section>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="twelve-columns footer">
|
|
<span class="nim-sprite"></span>
|
|
<br/>
|
|
<small>Made with Nim. Generated: 2016-11-08 21:32:32 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</body>
|
|
</html>
|