Questions tagged [json]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
58 views

Help! Update caused Craft to break

I haven't got around to do much with Craft yet, but I think I've installed it correctly - everything seemed to be working fine, but when I clicked the "update" button today, it broke. I now ...
Erica's user avatar
  • 11
0 votes
0 answers
79 views

Feed Me: import Assets custom fields data while importing new Entries

I have a JSON feed that import new Entries. In the imported fields, I have an image Assets field which is set up to create assets from their URL. "cover": [ { "url": "...
Romain P.'s user avatar
  • 1,798
1 vote
1 answer
18 views

Field data as part of external URL call (jsonclient plugin)

It's possible it's the various search terms I'm using but I can't seem to find anything close to what I'm looking for. I am trying to call an external API URL, with keywords from a field, but while I ...
Emma Swann's user avatar
1 vote
1 answer
495 views

How to retrieve (& output via twig) one key pair of json object stored i a database column

in commerce, all transactions are written into the database, into the table "commerce_transactions". every transactions will result in a row, where different data is the stored into columns. ...
Henrik's user avatar
  • 383
2 votes
2 answers
652 views

PHP array missing attributes when converted to JSON

I am converting certain php data to json for use in my front end javascript. I have an array of product variants, an array of images from a media field that is defined on my variants, and an array of ...
Augustine Calvino's user avatar
1 vote
0 answers
91 views

Automatically encode and decode JSON saved to Element

I have a custom element with an array property, which is to be saved to the DB as JSON, and a corresponding query class: use craft\base\Element; class Foo extends Element { public array $columns; ...
Matanya's user avatar
  • 452
1 vote
1 answer
43 views

Jsondecode in element API causing memory issue

I have the element api pulling back 1300 entries. One of the fields is storing geojson data and I had to change the type from text to mediumtext to accommodate some of the data stored. When I moved ...
joomkit's user avatar
  • 2,004
1 vote
1 answer
194 views

Feed Me with Related Entries Fields - One to Many Relationship

I'm using Feed Me to populate content for a "Meetings" section in my site. One of the fields in this section is "Meeting Attendees", which is an entries field relating to a ...
Ed Hebert's user avatar
  • 145
1 vote
1 answer
89 views

Feedme import formatting into Refactor from JSON

Having had a bit of a nightmare trying to get content out of Wordpress into Craft via Feedme have written an intermediary script to sanitise the WP XML export into something more palatable (JSON). ...
Cole Henley's user avatar
  • 1,741
2 votes
1 answer
149 views

Element API using the entries field to display related content from a separate section

I've seen similar questions but none seem to help. I have two sections named jobs and jobDescriptions. I'm using the entries field to pull in a description field from the jobDescriptions section to ...
lanceb's user avatar
  • 23
1 vote
2 answers
2k views

Twig json_decode gives Syntax Error

I'm trying to use the json_decode twig filter from Craft to decode an array of entry objects that got encoded in a macro. In the macro, the array of entry objects gets encoded by json_encode and ...
Joorren's user avatar
  • 305
1 vote
1 answer
330 views

Get a key value from a JSON asset in PHP

I'm using the Apple News plugin to try and display a tweet that's been added as a JSON asset in a matrix field. The JSON looks something like this { "title": "https://twitter.com/...
Bryce's user avatar
  • 251
1 vote
2 answers
163 views

Limiting entries object when using as json_encode

I'm building a JSON array of several thousand entries using the following entries query: {% set services = craft.entries.section('services').asArray().all() %} The problem is there some private info ...
casey's user avatar
  • 437
1 vote
1 answer
136 views

Error when trying to update Craft

I'm pretty new to CraftCMS and am trying to install updates for a client. I am getting this error and I don't really know what it means. Any help of brief explanation for this would be appreciated. ...
patricko's user avatar
  • 113
1 vote
1 answer
159 views

Import JSON feed data automatically without FeedMe

Can JSON feed data be displayed in a Craft site automatically? I have a page: URL/asdfh3 I've been dynamically using 'asdfh3' to pull in data from the JSON feed that is associated with 'asdfh3'. This ...
Jonathan's user avatar
1 vote
1 answer
2k views

Uploading Lottie animation files with images

For anyone who doesn't know what Lottie is, it is a video player created by the AirBnB team that lets you play vector animation exported from Adobe After Effects. It exports as json-files that you can ...
Stig Melón-Bratvold's user avatar
1 vote
1 answer
118 views

How to export Sprout Form submissions with a JSON API endpoint?

The goal is to have an endpoint that takes starting id and limit parameters and returns a filtered list of Sprout Form submissions as JSON without the JSON Feed v1 metadata bits. I've tried to set up ...
ponies's user avatar
  • 387
1 vote
1 answer
92 views

Click counter for links (craft v2)

So I'm new to PHP and ok with Javascript. I have a page on my site with a long list of external links, would it be possible to add a counter to be displayed next to each link that shows how many times ...
Stephenio's user avatar
0 votes
0 answers
298 views

Rest Controller and API Rate Limits or how to set CSRF token invalid

Problem: I have a JSON endpoint and like to limit access to it. I.e. to prevent double submits on contact forms or brute force attempts. One solution that came to my mind was rate-limiting the ...
nfo's user avatar
  • 101
4 votes
0 answers
230 views

Prevent Redactor from stripping tags like <span>

Is there any possible way to prevent <span> tags from being stripped from a Redactor field? I've tried all I can using custom Redactor and HTMLPurifier configs to no avail. Basically what I'm ...
James Sudimak's user avatar
1 vote
0 answers
44 views

Serializing assets field is returning a serialized criteria object, but how to return serialized data?

I'm saving a custom element that has content by field layout. When successfully saved, I return the object in the response. Now, most of the data is usable but the assets field is just a serialized ...
wietse's user avatar
  • 61
1 vote
0 answers
319 views

Entries as JSON files?

I work with VUE CLI and I want to build a entry form. My first Idea to bind in the data was props. They work but i can't modify the data (because it's props :D). To correctly integrate the data, my ...
Markus's user avatar
  • 11
1 vote
1 answer
210 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 ...
user924248's user avatar
1 vote
0 answers
394 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 ...
Syversen's user avatar
  • 475
3 votes
2 answers
724 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 ...
Kevon's user avatar
  • 160
1 vote
1 answer
1k 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 ...
JamesNZ's user avatar
  • 937
3 votes
0 answers
488 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.
Mforeman's user avatar
2 votes
1 answer
689 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.
LeBlaireau's user avatar
3 votes
1 answer
1k 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 ...
Simon Franzen's user avatar
1 vote
1 answer
591 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 ...
Chris's user avatar
  • 137
1 vote
1 answer
356 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 ...
Vin's user avatar
  • 373
0 votes
1 answer
129 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 ...
Vin's user avatar
  • 373
1 vote
1 answer
277 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,...
Bryce's user avatar
  • 251
1 vote
1 answer
190 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": {}, ...
BillyMedia's user avatar
1 vote
1 answer
665 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 ...
user2190590's user avatar
1 vote
2 answers
461 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 ...
user2909019's user avatar
1 vote
2 answers
608 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":"...
MikeeBee's user avatar
  • 155
1 vote
1 answer
86 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": "...
Chattervast's user avatar
2 votes
1 answer
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 ...
Aiden Bordner's user avatar
1 vote
3 answers
89 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 =...
Mark's user avatar
  • 717
1 vote
1 answer
819 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 ...
justussimon91's user avatar
1 vote
1 answer
337 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 ...
user3285578's user avatar
2 votes
1 answer
999 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 ...
sreucherand's user avatar
2 votes
1 answer
674 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":...
Lindsey D's user avatar
  • 23.9k
2 votes
1 answer
574 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 ...
Lindsey D's user avatar
  • 23.9k
1 vote
0 answers
200 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 ...
John Johnson's user avatar
6 votes
2 answers
3k 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 ...
Stephen's user avatar
  • 675
3 votes
2 answers
588 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 ...
Romain P.'s user avatar
  • 1,798
3 votes
2 answers
5k 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: { "...
user2909019's user avatar
1 vote
1 answer
618 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 ...
Branko's user avatar
  • 495