Skip to content

Commit

Permalink
Document tag ".json()"
Browse files Browse the repository at this point in the history
  • Loading branch information
tkeffer committed Mar 27, 2021
1 parent b8f04f0 commit 776a2a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 5 additions & 3 deletions docs/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ WeeWX change history
The utility wee_database has new options --add-column, --rename-column, and
--drop-columns for adding, renaming, and deleting columns in the database.

Introduced limited support for generating JSON in templates, particulary series.
New optional tag ".series()", for creating and formatting series in templates.
See the document series_tags.md in the docs subdirectory. This is still
experimental and subject to change! Addresses issue #341.

New optional tag ".json()" for formatting results as JSON.

New optional tag ".round()". Useful for rounding results of .raw and .json tags.

Improved performance when calculating series using aggregation periods that are
multiples of a day.

Expand Down Expand Up @@ -47,8 +51,6 @@ Updated the version of six.py included with WeeWX to 1.15.0. Fixes issue #657.
Option aggregate_interval can now be specified by using one of the "shortcuts",
that is, 'hour', 'day', 'week', 'month', or 'year'.

New optional tag ".round()". Useful for rounding results of .raw and .json tags.


4.4.0 01/30/2021

Expand Down
15 changes: 11 additions & 4 deletions docs/customizing.htm
Original file line number Diff line number Diff line change
Expand Up @@ -2171,17 +2171,24 @@ <h3 id="formatting_options">Formatting options</h3>
</tr>
<tr>
<td class="code text_highlight">.format(<em>args</em>)</td>
<td>Format the string according to a set of optional <em>args</em> (see below).</td>
<td>Format the value as a string, according to a set of optional <em>args</em> (see below).</td>
</tr>
<tr>
<td class="code text_highlight">.ordinal_compass</td>
<td>Output compass ordinals for wind direction (<i>e.g.</i>"SW"). The ordinal abbreviations are set by
option <span class="code">directions</span> in the skin configuration file <span class="code">skin.conf</span>.
<td>Format the value as a compass ordinals (<i>e.g.</i>"SW"), useful for wind directions.
The ordinal abbreviations are set by option <span class="code">directions</span> in the skin
configuration file <span class="code">skin.conf</span>.
</td>
</tr>
<tr>
<td class="code text_highlight">.json</td>
<td>
Format the value as a <a href="https://www.json.org/json-en.html">JSON string</a>.
</td>
</tr>
<tr>
<td class="code text_highlight">.raw</td>
<td>Value is returned "as is" without being converted to a string and without any formatting applied.
<td>Return the value "as is", without being converted to a string and without any formatting applied.
This can be useful for doing arithmetic directly within the templates. You must be prepared to deal
with a potential <span class="code">None</span> value.
</td>
Expand Down

0 comments on commit 776a2a1

Please sign in to comment.