You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 26, 2023. It is now read-only.
- Bugfix: Updated the members function to fit EE6.x
- Added json_pretty_print parameter for better readable output. Handy in the development stage
- Code cleanup
- Updated README
Copy file name to clipboardExpand all lines: README.markdown
+60-32
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Since legacy custom fields do not have their own table they will work fine eithe
19
19
20
20
***Fluid fieldtype***
21
21
22
-
Fluid fieldtype is not supported.
22
+
Fluid fieldtype is not yet supported.
23
23
24
24
## Installation
25
25
@@ -29,23 +29,27 @@ Fluid fieldtype is not supported.
29
29
30
30
### `xhr="yes"`
31
31
32
-
Set xhr to yes to only output data when an XMLHttpRequest is detected. Do not set this to yes if you are using JSONP, as JSONP requests are not true XHMLHttpRequests.
32
+
Set `xhr` to yes to only output data when an XMLHttpRequest is detected. Do not set this to yes if you are using JSONP, as JSONP requests are not true XHMLHttpRequests.
33
33
34
34
### `terminate="yes"`
35
35
36
-
Set terminate to yes to terminate the template and output your json immediately, with Content-Type headers.
36
+
Set `terminate=` to yes to terminate the template and output your json immediately, with Content-Type headers.
37
+
38
+
### `json_pretty_print="yes"`
39
+
40
+
For a better readable output. Combine with `terminate="yes"`. It's handy in the development stage.
37
41
38
42
### `fields="title|url_title"`
39
43
40
44
Specify which fields you wish to have in the array. Separate multiple fields by a pipe character. If you do not specify fields, you will get all of the default fields' data. The primary key (`entry_id` for entries, `member_id` for members) will always be present and cannot be suppressed by this parameter.
41
45
42
46
### `content_type="text/javascript"`
43
47
44
-
Set a custom Content-Type header. The default is "application/json", or "application/javascript" if using JSONP. Headers are only sent when terminate is set to "yes".
48
+
Set a custom Content-Type header. The default is "application/json", or "application/javascript" if using JSONP. Headers are only sent when `terminate` is set to "yes".
45
49
46
50
### `jsonp="yes"`
47
51
48
-
Set jsonp to yes to enable a JSONP response. You must also specify a valid callback. You are encouraged to set terminate to yes when using JSONP.
52
+
Set `jsonp` to yes to enable a JSONP response. You must also specify a valid callback. You are encouraged to set `terminate` to yes when using JSONP.
49
53
50
54
### `callback="yourCallbackFunction"`
51
55
@@ -139,15 +143,15 @@ for (i in data) {
139
143
}
140
144
```
141
145
142
-
If you require a different output format for the date fields, set the date_format= parameter. This uses the php date() function. common formats include "U" (unix timestamp in seconds), "c" (ISO 8601) or "Y-m-d H:i" (2011-12-24 19:06).
146
+
If you require a different output format for the date fields, set the `date_format=` parameter. This uses the php date() function. common formats include "U" (unix timestamp in seconds), "c" (ISO 8601) or "Y-m-d H:i" (2011-12-24 19:06).
143
147
144
148
## json:entries
145
149
146
150
```
147
151
{exp:json:entries channel="news"}
148
152
```
149
153
150
-
json:entries is a single tag, not a tag pair. Use channel:entries parameters to filter your entries.
154
+
`json:entries` is a single tag, not a tag pair. Use channel:entries parameters to filter your entries.
151
155
152
156
#### json:entries Default Fields
153
157
@@ -174,18 +178,26 @@ This will add categories to the entries response
174
178
175
179
##### `show_category_group="1|2"`
176
180
177
-
When paired with show_categories="yes", this will display only categories from the specified groups.
181
+
When paired with `show_categories="yes"`, this will display only categories from the specified groups.
178
182
179
183
#### json:entries Custom Fields
180
184
181
185
Most custom fields will just return the raw column data from the `exp_channel_data` database table. The following fieldtypes will provide custom data. You *must* specify the `channel` parameter to get custom fields.
182
186
183
-
##### Matrix
187
+
##### Date
184
188
185
-
The data will include an array of Matrix rows, including the row_id and the column names:
189
+
The data will be the Unix timestamp, accurate to milliseconds. This is because the native JavaScript Date object accepts a millisecond-based timestamp in its constructor.
186
190
187
191
```
188
-
your_matrix_field: [
192
+
your_date_field: 1385661660000
193
+
```
194
+
195
+
##### Grid
196
+
197
+
The data will include an array of Grid rows, including the row_id and the column names:
198
+
199
+
```
200
+
your_grid_field: [
189
201
{
190
202
row_id: 1,
191
203
my_col_name: "foo",
@@ -199,19 +211,21 @@ your_matrix_field: [
199
211
]
200
212
```
201
213
202
-
##### Grid
214
+
##### File Grid (EE v5.1+)
203
215
204
-
The data will include an array of Grid rows, including the row_idand the column names:
216
+
The data will include an array of File Grid rows including the row_id, the file and the optional extra column names:
205
217
206
218
```
207
-
your_grid_field: [
219
+
your_file_grid_field: [
208
220
{
209
221
row_id: 1,
222
+
file: "URL-to-your-file",
210
223
my_col_name: "foo",
211
224
other_col_name: "bar"
212
225
},
213
226
{
214
227
row_id: 2,
228
+
file: "URL-to-your-file",
215
229
my_col_name: "baz",
216
230
other_col_name: "qux"
217
231
}
@@ -226,15 +240,7 @@ The data will include an array of related entry IDs:
226
240
your_relationships_field: [1, 2]
227
241
```
228
242
229
-
##### Playa
230
-
231
-
The data will include an array of related entry IDs:
232
-
233
-
```
234
-
your_playa_field: [1, 2]
235
-
```
236
-
237
-
##### Assets
243
+
##### Assets (not tested with JSON v2+)
238
244
239
245
```
240
246
your_assets_field: [
@@ -289,7 +295,7 @@ your_assets_field: [
289
295
290
296
*NOTE: image manipulation urls are only available to Assets files store locally, not on Amazon S3 or Google Storage.*
291
297
292
-
##### Channel Files
298
+
##### Channel Files (not tested with JSON v2+)
293
299
294
300
```
295
301
your_channel_files_field: [
@@ -334,12 +340,31 @@ your_channel_files_field: [
334
340
]
335
341
```
336
342
337
-
##### Date
343
+
##### Matrix (not tested with JSON v2+)
338
344
339
-
The data will be the Unix timestamp, accurate to milliseconds. This is because the native JavaScript Date object accepts a millisecond-based timestamp in its constructor.
345
+
The data will include an array of Matrix rows, including the row_id and the column names:
340
346
341
347
```
342
-
your_date_field: 1385661660000
348
+
your_matrix_field: [
349
+
{
350
+
row_id: 1,
351
+
my_col_name: "foo",
352
+
other_col_name: "bar"
353
+
},
354
+
{
355
+
row_id: 2,
356
+
my_col_name: "baz",
357
+
other_col_name: "qux"
358
+
}
359
+
]
360
+
```
361
+
362
+
##### Playa (not tested with JSON v2+)
363
+
364
+
The data will include an array of related entry IDs:
365
+
366
+
```
367
+
your_playa_field: [1, 2]
343
368
```
344
369
345
370
## json:search
@@ -456,12 +481,17 @@ function yourCallbackFunction(data) {
456
481
457
482
## Changelog
458
483
484
+
### v.2.5.2
485
+
486
+
- Bugfix: Updated the `members` function to handle both legacy (pre EE4) and newer member data
487
+
- Added `json_pretty_print` parameter for better readable output. Handy in the development stage
488
+
- Code cleanup
489
+
- Updated README
490
+
459
491
### v2.5.1
460
492
461
493
- Bugfix: Removed all remnants of fluid field data, since the Fluid fieldtype is not (yet) supported. The remnant data is unusable at this point. Working on support for Fluid fieldtype
462
-
- Bugfix: Updated the `members` function to fit EE6.x
463
494
- Changed `addon.setup.php` and cleaned it up
464
-
-**Note:** not tested with Assets, Matrix, Playa and Channel Files fieldtypes/modules
465
495
466
496
### v2.5.0
467
497
@@ -470,15 +500,13 @@ function yourCallbackFunction(data) {
470
500
- Added support for File Grid fieldtype
471
501
- Added support for legacy custom fields and data (EE2 and EE3 custom fields and data) for compatibility with upgraded versions of EE4+
472
502
- Added `/system/user/addons/json/icon.png` for the EE6 control panel
473
-
-**Note:** not tested with Assets, Matrix, Playa and Channel Files fieldtypes/modules
474
503
475
504
### v1.1.9
476
505
477
-
-EE3 compatibility
506
+
-ExpressionEngine 3.x compatibility
478
507
- Added relationships support for grids as per [ahebrank's](https://github.com/ahebrank)[commit](https://github.com/rsanchez/json/pull/65)
479
508
- Added `/system/user/addons/json/addon.setup.php` for EE3
480
509
- Added `/system/user/addons/json/README.md` for the add-on manual in the control panel (as of EE3)
481
-
-**Note:** not tested with Assets, Matrix and Playa
0 commit comments