Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [json]

The tag has no usage guidance.

1
vote
1answer
25 views

Element api JSON output formatting

I want to output all globals with one endpoint. This is trivial for the most part but I need to have some objects in a specific shape. I'm using a matrix block to handle the content. The main issue ...
1
vote
0answers
56 views

Escaping rich text fields to json but keep html markup

I am trying to create an export from an old Craft2 site over to a new Craft3 site. The structure and fields are all different, so I figured the easiest way was to create a json file from my entries ...
2
votes
1answer
75 views

How to store custom data into a user

I need some direction in how to store (complex) data into users (best practice) I'm working on a project for a fitness app. I created a structure with 2 levels for workouts where level 1 entries are ...
1
vote
1answer
253 views

Craft 3 Plugin Controller - returnJson() replacement?

In Craft2, when making an ajax request to a plugin controller action, you would use the returnJson() method which is part of the BaseController class - which your plugin controllers extend. This sets ...
1
vote
0answers
107 views

JsonLD & Schema

What is the best way to use Json-LD schema in the templates for Craft 3? I would like to dynamically load parts of the info. I know about the SEOmatic plugin but looking for a way to do it on my own.
2
votes
1answer
111 views

Getting all the values out of a field as array of values

I have a multi-select field in my work section I want to get the values either with the Element api as json or an array of simple values in my template.
0
votes
0answers
66 views

Getting Solspace Calendar Events with ElementAPI

I have started to use ElementAPI and Solspace Calendar plugins on a project and I'm trying to get a JSON feed of all events so I can dynamically load certain events with ajax. Here's a question about ...
1
vote
1answer
390 views

Are there any alternatives to the deprecated Export plugin?

This thread Export Craft Data leads me to add a new question. What is a good Craft 3 export plugin? I know several for imports, for example the FeedMe plugin is doing a great job, but nothing to ...
1
vote
1answer
228 views

When saving an Entry, I receive a JSON response rather than returning to the Entry's edit page

Craft Version: 3.0.4 Web Server: Apache + Nginx proxy Recently I've been working on a couple of Craft 3 projects for deployment on my institution's web servers. In the past, I've successfully ...
1
vote
1answer
119 views

FeedMe Pro Import JSON

When I import using JSON with FeedMe Pro and need to import more records into an entry that has a Matrix field. I find it deletes the previous and adds the new data only. Is there anyway to append to ...
0
votes
1answer
84 views

Help with FeedMe JSON

I am trying to insert records into the same entry using FeedMe with Matrix and Table for one of the fields. My table field is a plain text. So I have one programLevel, one program and a field that ...
1
vote
1answer
52 views

Use FeedMe with a dynamic URL

The list of entries I need to grab is available here: http://arcresources.mediaroom.com/api/newsfeed_releases/list.php?format=json Each individual entry is available at a unique URL, by adding an ID,...
1
vote
1answer
90 views

Using elements-api, how do i create a geojson structure with Features within a FeatureCollections

I am trying to output, from a single request, a geojson structure like so: "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, ...
1
vote
1answer
323 views

Element API with multiple categories gives back error 500

This works fine on localhost but crashes on remote Server. I can return one category, but it will crash when I try to display multiple categories. I also tried to save the categories in a variable and ...
1
vote
2answers
216 views

Querying channel entries hits memory limit

We have a channel that has about 700 entries but is paginated with a limit of 30 entries. Our client is looking to add a button so users can print out all entries. One of our proposed solutions was to ...
1
vote
2answers
304 views

Feed Me: Valid JSON file returning as invalid

Can anyone see why this data would return as invalid in Feed Me? It's valid JSON. [ { "FIELD1":"1", "FIELD2":"Airmax", "FIELD3":"150-08ACW-134 ", "FIELD4":"...
1
vote
1answer
75 views

Assign User to Group While Importing on Sprout Imports

we are trying to import users into a specific group but cant figure out how the json should go. Currently we have: [ { "@model": "User", "attributes": { "username": "...
2
votes
1answer
1k views

JQuery $.ajax “:success” form logic with Plugin Controller?

I'm working on a simple plugin to facilitate front-end, anonymous lead generation forms submitted to Salesforce via cURL to it's Web-to-Lead servlet. The logic and data transfer are working (debug ...
1
vote
3answers
73 views

Placid plugin - limit returned results

I'm trying to limit the results to 5, but its returning all of the results instead. I am using the below code: {% set options = { cache : false, query : { limit : 5 } } %} {% set timeline =...
1
vote
1answer
564 views

Element API: Remove additional set of square brackets from JSON-String

We're currently having an Android-App access some of the entries of our Craft-based website. We are currently still using a self built API, and for easier creation of new API-Calls we are trying to ...
1
vote
1answer
169 views

Saving Form Data to Plugin Record via Javascript

I am new to Craft plugin development, so I apologize ahead of time for my lack of understanding. I'm working on a plugin that allows the user to "upload" Excel/csv files via the control panel that ...
2
votes
1answer
649 views

Element API + JSON data in template

Is there any way to include the JSON response from element API in a template. Let's take the following example: /case-studies.json returns: { data: [ { title: "American ...
3
votes
1answer
306 views

Feed Me: How to format JSON for a table field?

I need to import some data into a table field. What's the best way to format the data in my original JSON feed? I've tried this: [ "first value", "second value", ] and this: [ {"col1":...
3
votes
1answer
267 views

Feed Me: Importing a relationship between elements

I want to import a bunch of films, which all have certain genres. The genres have already been set up as Categories in Craft, so each genre already has an Element ID (if that's relevant). Here's a ...
1
vote
0answers
131 views

CSV/JSON data imported to dynamic table

I'm looking for a solution that will allow me to turn a CSV or JSON data file into a table on the front-end of a website. Ideally the data would be imported into the database and then output into a ...
5
votes
2answers
1k views

HTML Purifier Config File

I noticed the following new feature in Craft CMS 2.6.2973: Added the “HTML Purifier Config” setting to Rich Text fields. I can't see any mention or any example of config files in the Craft CMS docs ...
2
votes
1answer
201 views

How to skip the first X entries using ElementAPI

I'm looking how to use the .offset(x) parameters of craft.entries inside the ElementAPI. I tried to add 'offset' => 1 before, after and inside the criteria array, but the x first entries are still ...
3
votes
2answers
3k views

Passing JSON to Twig

I'm creating a multilingual site and I'm looking to pass some additional configuration data to Twig so I can use it in my template. For example, suppose I have a configuration like this: { "...
1
vote
1answer
457 views

Redactor can't add image into toolbar

In my rich text field I want to add images to the toolbar. I have done everything that has to be done: I've added "image" to the Standar.json file and selected the Standard.json to be used for the ...
2
votes
1answer
905 views

Image transforms not working properly

I have 2 basic JSON files, the only difference between the files is the product.type('') In my general.php I have turned on 'generateTransformsBeforePageLoad' => true, The first JSON file (200 ...
3
votes
1answer
3k views

Loop through JSON object in Twig from the database

I've written a custom plugin that stores data as JSON in a TEXT column (field_gridcontrol) in Craft's content table that looks something like this: [ { "id": "35", // id is an element's id "...
3
votes
0answers
590 views

Ordering Element API by Category and Title

I'm looking for a way to order the ElementAPI json array by category and title. I can only get one to work whether it's 'group' => 'stockistRegion.first().title' or 'order' => 'title' using the ...
2
votes
2answers
2k views

Removing P tag's in rich text area's

Before you think this has already been answered, yes it is but I can't manage to get that fix working so I'm looking for another one. I have a "title" field in a couple of my matrix blocks but my ...
1
vote
0answers
290 views

Twig json array error in javascript with barbs.js

I'm having issues with the following code every since I added barbs.js (a page transition library) to my site. Basically I have a js file that controls the transition and ajax. The following code ...
2
votes
1answer
315 views

Creating a guest entry, with a Matrix field, using Ajax

I'm trying to submit a guest entry by building a javascript array of objects to mimic a form submission and submit using ajax. I've managed to successfully submit the entry with just a title but when ...
5
votes
2answers
654 views

Access Element API JSON in another environment

First Craft project and off to a great start. I don't think i'll ever touch Wordpress again. :) I'm using the Element API plugin to build out one of my feeds of entries and hoping to use that on a ...
2
votes
1answer
2k views

How do I add meta data and a page title through ajax?

I have looked a lot through this StackExchange but I guess I am not too advanced in using AJAX/Json. My aim is to have page transitions using Ajax. This was rather easy to accomplish following this ...
4
votes
1answer
1k views

Get Assets in JSON with ElementAPI

I'm trying to integrate the ElementAPI plugin into my site. Essentially, I need to output all of the assets within the website into a JSON file that I can link to in the load manifest of PreloadJS. If ...
7
votes
2answers
756 views

Can I change which 'Format' options are available in my Rich Text field?

I want to update my Rich Text field so only H1, H2 and H3 are the available options in the 'Format' selector. Is this possible?
2
votes
2answers
691 views

ElementAPI - Can I use javascript/ajax to load json

Probably a dumb question, but since i wasn't sure while reading on github, i'll ask here. I am wondering if I can reach the JSON I created with an URL or is it only for use in PHP? I would like to ...
2
votes
1answer
513 views

Output Matrix Block with Element API Plugin

Below is my code to output the news entires under the "news" section of my site using the Element API. My question is how do I output the matrix block with a block type of "text" with a field called "...
3
votes
1answer
180 views

Using setExpires on returnJson

From a custom plugin controller, I am returning data as json using $this->returnJson($data). I need to be able to set the Cache-Control headers for my forward cache proxy to handle caching ...
2
votes
1answer
833 views

Element API User example

I am attempting to build an application where Craft handles all of the API based data (JSON). I am using the Element API. I can't find an example anywhere online that outputs Users. I am trying to ...
4
votes
3answers
798 views

Creating environment variable from JSON file

Brand new to Craft here. I'm trying to port across my gulp workflow to Craft and basically everything has gone super smooth. Just one last obstacle due to my lack of knowledge of the Twig templating ...
1
vote
1answer
271 views

Integrating and Caching Weather Data from Forecast.io API

Does anyone have any experience with integrating the forecast.io API for location data for a Craft CMS site? I haven't been able to find any direct plugins for Forecast.io, but I was investigating ...
3
votes
1answer
118 views

Looping out a lot of entries.

Ok, so I'm looping through a lot of entries. It's a large request, and I had to up php memory limit to 512M. But I'm sure there is a less memory consuming way to do this. Also, I want to cache the ...
0
votes
1answer
825 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
660 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
547 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
163 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 | ...