[CCSDK-28] populated the seed code for dgbuilder
[ccsdk/distribution.git] / dgbuilder / core_nodes / parsers / 70-JSON.html
1 <!--
2   Copyright 2014 IBM Corp.
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8   http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15 -->
16
17 <script type="text/x-red" data-template-name="json">
18     <div class="form-row">
19         <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
20         <input type="text" id="node-input-name" placeholder="Name">
21     </div>
22 </script>
23
24 <script type="text/x-red" data-help-name="json">
25     <p>A function that parses the <b>msg.payload</b> to convert a JSON string to/from a javascript object. Places the result back into the payload.</p>
26     <p>If the input is a JSON string it tries to parse it to a javascript object.</p>
27     <p>If the input is a javascript object it creates a JSON string.</p>
28 </script>
29
30 <script type="text/javascript">
31     RED.nodes.registerType('json',{
32         category: 'function',
33         color:"#DEBD5C",
34         defaults: {
35             name: {value:""}
36         },
37         inputs:1,
38         outputs:1,
39         icon: "arrow-in.png",
40         label: function() {
41             return this.name||"json";
42         },
43         labelStyle: function() {
44             return this.name?"node_label_italic":"";
45         }
46     });
47 </script>