JSON is a text-based open standard. It is human-readable and used for data interchange between applications. Use this tag for questions related to topics such as 'JSON used in Drupal web services (REST)' or 'JavaScript callback functions which returns data in JSON format'.

learn more… | top users | synonyms

0
votes
1answer
23 views

Can't save location when posting node through services module

I am using services module to post nodes using rest/json. The nodes also contain images and location. So far I can upload the image and save the node, but the location is not saved. I receive no ...
1
vote
1answer
21 views

How to calculate margins based on JSON and ONIX (XML) input and calculate points based on them?

In a Drupal Commerce distribution based on Drupal 7 we sell books. First I want to calculate a margin price based on several given data. The JSON is imported or can be manually added. The ONIX (in ...
0
votes
2answers
98 views

How to import nodes with custom fields using Feeds module and Feeds JSONPath Parser

I've got a content type called 2Wd-Tractor with this structure : Model (node title) Engine Transmission Operational Hydraulic System Engine field is a custom field implemented using Field Api and ...
1
vote
1answer
50 views

Ajax callback return 500 Internal Server Error

file mymodule.inc : $items['ajax/channel/%/get-program'] = array( 'title' => t('get channel program by ID'), 'type' => MENU_CALLBACK, 'page callback' => ...
0
votes
1answer
22 views

Export sorted View to JSON

I need some expert help. I need to export data into JSON. Here are the steps I followed: 1> Created a draggable view to allow admin to provide appropriate sort order. ref ...
0
votes
0answers
20 views

Can not get JSON data

I am using Drupal 8, and I am currently developing a Custom Module, and this is my first time using Drupal and Drupal 8. I am having an issue, which is trying to get JSON values from a JSON file and ...
0
votes
0answers
21 views

How to convert multiple node in Json format to use in Apps?

I have created a custom module which takes post argument and sent the result in json format. function cfood_api_get_stadium_list($cn, $city){ $query = new EntityFieldQuery(); $entities = ...
0
votes
1answer
15 views

Views AJAX functionality works, but nothing changes at all

All AJAX functionality doesn't work properly. Response body: [{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"my_theme" ...
0
votes
0answers
19 views

Field Collection values in json data document view

I am wondering if I am hitting the limits of what can be done with the json data document view for displaying output and whether I need to just write my own module or use php's json_encode to do this. ...
0
votes
0answers
32 views

feed drupal 8 custom block with json decode content

i have created a block and try to feed it with WS request function amu_news_preprocess_block(&$variables) { if ($variables['elements']['#configuration']['id'] == 'amu_news_block') { ...
0
votes
2answers
30 views

How can I let images uploaded via ckeditor show their full url in a json request via REST?

I have textarea fields in my headless drupal 8 site. When I get the node via REST in json it does not give the domain name in the image urls that are uploaded via ckeditor. So the images are not shown ...
1
vote
1answer
18 views

Output the “Body” field with markup using Views PHP to be used in Views Datasource (JSON)

We are creating an API using Views/Views Datasource and we want to output the Body field with markup already in the field not plain text. How can we do this? This Views_PHP approach just outputs the ...
1
vote
1answer
87 views

Drupal 8 node serialization to JSON

I am trying to use \Drupal\node\Entity\Node::load($nid) to store a node object in a variable and pass the variable into drupal 8's serialization component or even symphony's serialization methods. All ...
2
votes
2answers
43 views

Drupal as a RestAPI

I have been using Drupal for a while to build medium to large CMS systems; love it. From time to time I have to build a RestAPI. Usually I use either Laravel, Lumen or Slim. The only reason why I ...
0
votes
1answer
28 views

Calling json from <a>

in mt .tp file I have a loop that outputs Publish or something similar for each entry. I don't want it to refresh the page when clicking on the so I want to call some json instead to call a module ...
0
votes
0answers
18 views

When I request a _format=json of a node, the default values of image fields are not returned. How do I get those?

In the content type I have created an image field with a default value. When I create a new node and decide "default value" is fine and I save the node then when I request a _format=json of this ...
0
votes
0answers
25 views

How to make an Openlayers map based on geojson layers with exposed filters?

Openlayers builds maps combining multiple layers, some of which are based off of view into a single map. From what I have experimented with, putting an exposed filter on a geojson based views, doesn't ...
2
votes
2answers
74 views

How to export 'Content-Type' data into JSON?

I'm using Drupal 7 and I've created a content type as 'CONTENT_TABLE', which includes multiple fields (COLUMNS) as such: CONTENT_ID, CONTENT_NAME, LARGE_THUMBNAIL, ZIP_FILE... I want to export the ...
0
votes
0answers
16 views

How to build a json hierarchy? [duplicate]

I wonder how I can build json with a hierarchy in a Drupal site. Eg : events: { "2014-04-30": {"number": 5, "badgeClass": "badge-warning", "url": "http://w3widgets.com/responsive-slider"}, ...
2
votes
2answers
213 views

Drupal 8 REST - How to export Drupal 8 Main navigation menu with REST service (JSON)

I have tried to GET main menu with rest path "/entity/menu/{menu}" but all I get in response JSON is a menu properties as uuid,language,id... without menu structure (links...). { "uuid": ...
0
votes
1answer
29 views

Drupal Views Datasource and Flag Links

I want to use Views Datasource module to output JSON, i then want to construct the JSON output using REACT JS or alike. I am currently stuck on how to output the Flag Link, it just comes back with an ...
0
votes
1answer
9 views

How to show more than two fields in a Openlayers popup on a views_geojson layer?

I have finally gotten my OpenLayers working, and I'm trying to show 7 fields about my points in a popup. By default, Views_geojsononly allows you to define a title and description fields for tooltips. ...
0
votes
1answer
22 views

Turn Drupal into a USER API

I'm developing the main website (A) for an organisation in D7 but for other reasons there are microsites (B) related to this website using CMSs. I need to give this other users an endpoint in which ...
0
votes
0answers
9 views

What nodes have been created when an “attached” feed importer has been run?

I have a feed importer defined on my site via the JSONPath parser. The feed importer pulls in bibliographic data for a third party source, via the API provided by that third party. It creates a node ...
0
votes
1answer
45 views

How to get services post data(json format) callback function?

I am using services module and rest API its working fine. But i need to create a menu callback where i get the json post data and save in database. How to get the json data in menu callback?
0
votes
1answer
50 views

Search a content type and return JSON [duplicate]

I'm trying to create a JSON API that will return an array of JSON results matching specific search criteria. It will always be searching one specific content type, but will need to match custom ...
0
votes
1answer
52 views

fastest between hook_js vs hook_menu to get JSON via REST

I'm trying to figure out if in my case it makes sense to use the High-performance JavaScript callback handler module. Between js/MODULE/example.json (hook_js()) and example.json (hook_menu()), the ...
0
votes
2answers
97 views

JSON fromat for user login with Email address - Services

Drupal login form allows users to enter their username or email to login into the site. I need to achieve the same thing with services. But services allows users to login with username (not working ...
0
votes
1answer
82 views

How to print Json data from Facebook in a block?

I would like to print the amount of Facebook likes for a url into a block. The Facebook API returns JSON like so: ...
0
votes
0answers
26 views

No reply from rest service after creating two nodes

I had to fill a website with 12000 nodes , so I wrote a c# application which sends nodes (encoded in JSON format) from my local computer to website. using services module proper resources are ...
1
vote
1answer
18 views

How to fetch all the details of a marketplace organization's page on Drupal.org

I am new to Drupal. I am trying to fetch all the details of a marketplace organisation's page, which are visible on drupal.org. I am using the node id to access ...
1
vote
0answers
19 views

Getting my data into drupal 7 [duplicate]

I manage a list of contact names, phone, fax, location/address, job title and department in a simple text file. That text file is then turned into a JSON file. I want to have drupal pages with ...
1
vote
2answers
33 views

Is it safe to send the unencoded JSON output?

The mobile app developers wants an api to get a list of articles from our Drupal site. It should have these fields in the output: nid title field_teaser_body The api resonse has to be in JSON ...
2
votes
1answer
72 views

How can I return literal JSON from a node as a JSON object in views json?

I have a content type with a field called output. This field will contain JSON. I want to output this field as JSON using Views JSON (in Views Datasource). The problem I'm encountering is views ...
0
votes
1answer
64 views

how to prevent user from clicking button twice on server side in jqx [duplicate]

$('#save').on('click',function(){ $('#form').jqxValidator('validate'); }); How can I prevent user from click button twice on server side?
0
votes
2answers
409 views

How to call external api to pull data into json format?

There is an api that is used to expose data from an external website. How can I use the drupal API to call the external api and pull the data into json format? the external api would be, for example, ...
0
votes
1answer
78 views

insert json into db

I'm trying to store some JSON data as string into database, but db_query change my JSON {} to table prefix. So I have wrong JSON in DB as result. How can I prevent such behavior?
0
votes
0answers
24 views

It is possible to use a view formatted autocompletion json as the results of a FAPI textfield autocomplete?

I'm trying to do a fapi element autocomplete textfield using a view formated autocompletion json I mean, created a view which returns a json using a exposed filter criteria. The view as is works ...
1
vote
1answer
34 views

JSON Menu Link Without Invoking Init Hooks?

Our Drupal site utilizes a number of menu hooks to return JSON from an API we manage in a separate Web API. We also have a number of intensive tasks that happen on each page load via the hooks_init in ...
1
vote
1answer
216 views

Drupal 8 REST - POST json data denormalization error

I created rest resource plugin in a custom module and need to send some JSON data with the request, and access it in the post function. At the moment my post function does not do anything but return ...
-1
votes
1answer
74 views

Web Services - GET Request Article (HAL+JSON)

I'm trying to make a GET request to a specific article on my drupal 8 website (local). These are the steps I've done: Enabled all 4 Web Services modules at the modules page Created an article (url: ...
0
votes
0answers
57 views

How can i remove the whitespace generated before file field in views output

i have a drupal content type with one file field. Now i created a view of list of contents of that type with the file field on display. In the output the file field shows the file along with mime ...
1
vote
1answer
483 views

Drupal 8 REST Post creating entities with relations

I am having trouble creating comments on nodes ( articles etc. ) with the Rest module. I have enabled the endpoint in rest.settings.yml : resources: 'entity:node': GET: ...
1
vote
1answer
94 views

How to create authentication token in the HTTP header request for Json view

I have a view listing some fields from a content type then i made it in a Json format using View DataSource module, all is ok with me tell now i want to add authentication token in the header request ...
2
votes
0answers
103 views

drupal_http_request returning Invalid JSON primitive:

I am developing a module for Drupal 7 that has t make a call to a remote API. I am using drupal_http_build_query and drupal_http_request and finally drupal_json_decode to decode the output. My code ...
0
votes
0answers
92 views

Render JSON View with array of objects in a field

I am trying to use the views datasource module to render an array of JSON objects. That works fine for a while, until I get to an object with a field that should contain an array of 3 more objects. ...
1
vote
0answers
103 views

REST export doesn't give image URLs

We have a headless Drupal 7 project that uses express and handlebars for it's front end. I'm experimenting with updating the backend to use Drupal 8. I've created a REST export type view, but when ...
0
votes
1answer
94 views

Create node from JSON

I'm looking to write the following module, any help, guidance, and advice would be greatly appreciated. User is logged into site. Site has two content types: page & note. Logged in user can ...
0
votes
0answers
82 views

Recommended solution for JSON decoding and caching in Drupal 7

I'm trying to find a way to use some of Drupal's modules to query URLs that respond in JSON and cache them after decoding. I'll describe in detail. What I have: This is an example of the script: ...
0
votes
0answers
55 views

How to import JSON data from a XML element

I'm completely stuck with this problem for days now and I hope someone can help me out. I'm no expert in XPath so please forgive me if my question is a bit noobish: I want to import XML data from a ...