Questions tagged [json]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
1k views

How to pass an entry's Matrix fields as JSON?

Have a JSON object that I'm trying to pass to my Javascript through a script tag in my markup like so: <script type="text/json" id="json-data"> { "terms": "{{ entry.termsAgreement }}", "...
0
votes
1answer
761 views

How do I access the category of an entry with Element API?

The category count is only ever 1 and I need to output the name of the category the entry belongs to. Would there need to be a cross-over between the EntryModel and CategoryModel? 'transformer' =>...
0
votes
2answers
716 views

Formatting postDate using the ElementAPI plugin

Building a small AngularJS app and using the ElementAPI plugin for the first time. I can set 'postDate' => $entry->postDate which gives me postDate : { date: "2015-12-10 07:04:02.000000", ...
1
vote
1answer
177 views

How can i get API-Response that includes localized data using json_expand?

My index.html endpoint in the templates folder looks like this: {% header "Content-Type: application/json" %} {% set basics = craft.entries.section('basics').find('') %} {{ basics | ...
0
votes
1answer
396 views

Fail in JSON using Twig

Inside a JSON template I find an entry using id, the result title can't be seen using entry.title but I can see it with entry[0].title. There is another step or encoding I have to use?
5
votes
2answers
2k views

HTML/View Source button not working/showing in WYSIWYG Craft 2.5 / Redactor II 1.1.0

The "HTML" button no longer seems to show in the WYSIWYG. The button is set in the Redactor config file like so: { "buttons": ["html","formatting","bold","italic","unorderedlist","orderedlist","...
3
votes
1answer
216 views

Element API: Entry field inside a Channel entry being passed into JSON file

Hopefully my titles makes some sense but I will try to elaborate. I have a Channel entry called Movies that I am using the Element API to turn into JSON. There is a field inside that called Movie ...
3
votes
0answers
268 views

Getting related entries along with entry using the Element API plugin

I want to list all the related entries to the entry I am displaying using the Element API plugin. I have a channel called series and another called episodes, the episodes have a relationship with 1 ...
1
vote
0answers
126 views

How can i request image locations through elements api for an entry in section?

i have endpoint: 'news/<slug:{slug}>.json' i print out EntryModel-Class in transformer function and it doesn´t seem to contain any photos like how it is described in Element Api example loop at ...
2
votes
1answer
1k views

Return json formatted entries and include a header for Access-Control-Allow-Origin

Hi Not sure on the best way to do this. I have some javascript that requires a json formatted file to populate a calendar. I can do this in php by adding the following to the file that is being ...
0
votes
1answer
200 views

Can Craft's Rich Text fields be configured to use Redactor's autosave?

The question really says it all. Here's the autosave docs page: http://imperavi.com/redactor/docs/settings/autosave/
4
votes
2answers
2k views

Passing multiple parameters to the Element API

How should I go about passing multiple parameters to the Element API? The scenario is that I would like to display all my categories for a given section in a form, and allow the user to select ...
5
votes
1answer
2k views

What criteria can the Element API plugin accept?

I have a structure called "locations" that contains two entry types: State Location I'd like to access specific states at the URL locations/ny.json, for example, and get a JSON object with all the ...
1
vote
1answer
391 views

Using Craft Prune - convert JSON Array of Objects to simple array

I am using the Craft Prune plugin (https://github.com/mattstauffer/craftcms-prune) to pull out a JSON array of entries from a section of my site with the aim of integrating the data into a typeahead ...
0
votes
1answer
691 views

Using FeedMe with the instagram API

Just downloaded FeedMe, and it seems like a great solution to what I want to do, but I can't get it to succesfully run a json import on a feed generated by instagram. When I hit 'Save and Continue', I ...
1
vote
1answer
1k views

Best solution for get json results from third party api?

I need to get blog posts from hubspot api using this approach. http://developers.hubspot.com/docs/methods/blogv2/get_blog_posts Since craft uses twig I'm unable to use php in the templates, so I ...
5
votes
1answer
932 views

Use of undefined constant JSON_HEX_TAG

I'm running PHP 5.3.3, which the docs say is supported, but if I try to go to the main admin page or go to add a field, I'm getting an error: Use of undefined constant JSON_HEX_TAG - assumed '...
1
vote
1answer
183 views

Dealing with long lists of items

I'm looking for the best way to deal with long lists of items. In this case a subsite is a council library area which must publish a list of new books each month. In a perfect world I would suck this ...
0
votes
1answer
578 views

How to set a response 200 from a plugin?

I’ve tried HeaderHelper::setHeader(array('code' => 200)) without success.
3
votes
2answers
1k views

Craft as a CMS for mobile app content

We're just looking at potentially using Craft as a CMS to serve up content to a mobile apple/android app. Ideally content would be delivered as JSON and there be some sort of authentication from the ...
1
vote
0answers
79 views

How to retrieve a data from a custom table to JSON? [duplicate]

I'm trying to retrieve the data from the database and return it to JSON so that I can access the data in jquery... thanks!
1
vote
3answers
2k views

How to store json data in a custom fieldtype so that it's data can be referenced as attribute values?

I would like to store a json object in a custom fieldtype, and be able to traverse the object's attributes using twig dot syntax in my template. I am currently storing the raw json object as a string, ...
5
votes
2answers
2k views

Creating entries from JSON feed - plugin?

I'm wondering if this plugin already exists and I'm just not finding it on Github or via Google. Essentially looking for a CraftCMS version of the ExpressionEngine plugin called "Data Grab" - http://...
3
votes
2answers
2k views

PHPUnit - Warning: “Header already sent”

I'm trying to cover the plugin controller with unit tests, but when I try to run phpunit this error shows up: Warning: Cannot modify header information - headers already sent by (output started at /...
3
votes
3answers
321 views

BaseController::returnJson & devMode interference

While developing an API for a client site I recognized that there was a tag being returned after our JSON response (generated using BaseController's returnJson method). I copy & pasted some of ...
6
votes
2answers
2k views

Craft CMS and JS/MVVM frameworks

Does anyone have an experience in using Craft in conjunction with a front-end JS MVC/MVVM framework such as Backbone, Ember or Angular? We have a project coming up where there may be a lot of JS ...
8
votes
1answer
456 views

Console script tags garbling up non-html output (e.g. json) when in devMode

I have a plugin returning json from a controller action using $this->returnJson(...). Works great in production, but when devMode = true, the json is invalidated because Craft is still dumping the ...
35
votes
5answers
10k views

How can I retrieve channel data in json format?

I've played around with a few implementations but I still don't feel like either is right. I first came across building the JSON itself. This would be in a file at "craft/templates/entries.json". [ ...

1
2