File tree Expand file tree Collapse file tree 1 file changed +53
-3
lines changed Expand file tree Collapse file tree 1 file changed +53
-3
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,57 @@ <h3 id="example">Example</h3>
103
103
</ div >
104
104
105
105
106
+ < div class ="hgroup ">
107
+ < div class ="hgroup-inline ">
108
+ < div class ="panel ">
109
+ < h3 id ="text_output "> Generating non-JSON output</ h3 >
110
+ </ div >
111
+ < div style ="clear: both "> </ div >
112
+ </ div >
113
+ </ div >
114
+
115
+
116
+ < div class ="hgroup ">
117
+ < div class ="hgroup-inline ">
118
+ < div class ="panel ">
119
+ < p >
120
+ Sometimes it is useful to generate output that is not in JSON format. You can do this by
121
+ writing Jsonnet code which evaluates to a string containing whatever your desired format
122
+ is. When executed with < tt > jsonnet -S</ tt > or < tt > jsonnet --string</ tt > jsonnet will
123
+ manifest the string result as plain text rather than a JSON-formatted string.
124
+ </ p >
125
+
126
+ < pre > // ini_output.jsonnet
127
+ std.manifestIni({
128
+ sections: {
129
+ main: {
130
+ host: "127.0.0.1",
131
+ port: "9000",
132
+ },
133
+ database: {
134
+ path: "/var/data",
135
+ },
136
+ },
137
+ })</ pre >
138
+
139
+ < p >
140
+ When executed using < tt > jsonnet -S ini_output.jsonnet</ tt > , this will output the generated
141
+ INI formatted text directly.
142
+ </ p >
143
+
144
+ < pre > $ jsonnet -S ini_output.jsonnet
145
+ [database]
146
+ path = /var/data
147
+ [main]
148
+ host = 127.0.0.1
149
+ port = 9000</ pre >
150
+
151
+ </ div >
152
+ < div style ="clear: both "> </ div >
153
+ </ div >
154
+ </ div >
155
+
156
+
106
157
< div class ="hgroup ">
107
158
< div class ="hgroup-inline ">
108
159
< div class ="panel ">
@@ -148,12 +199,12 @@ <h3 id="multi">Multiple File Output</h3>
148
199
< pre > $ jsonnet -m . multiple_output.jsonnet
149
200
a.json
150
201
b.json
151
- $ cat a.json
202
+ $ cat a.json
152
203
{
153
204
"x": 1,
154
205
"y": 2
155
206
}
156
- $ cat b.json
207
+ $ cat b.json
157
208
{
158
209
"x": 1,
159
210
"y": 2
@@ -288,4 +339,3 @@ <h2 id="javascript">JavaScript</h2>
288
339
< div style ="clear: both "> </ div >
289
340
</ div >
290
341
</ div >
291
-
You can’t perform that action at this time.
0 commit comments