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

1
vote
0answers
12 views

Drupalgap android app using quiz module

I am trying to create a Drupal 7 quiz site of multiple choice questions. The users should be able to attempt quiz on the desktop site and as well as on an android app developed using Drupalgap module. ...
0
votes
0answers
18 views

How do I periodically import JSON feeds?

I'm looking to generate content based on the contents of a Google spreadsheet. I would naturally use Drupal feeds, with the JSONPath Parser, in Drupal 7, but this is not available in Drupal 8. I ...
0
votes
0answers
28 views

How to save latitude/longitude with Services module

I've designed a website and I'm using Geolocation to store geographical location of businesses. Now I'm going to create an app to save businesses and their location data with GPS. I pass data like ...
1
vote
0answers
62 views

Update node via external API JSON

I've got a custom content type "Publications" with custom fields. Two of these fields are: DOI (document object identifier), a unique identifier for the publication Altmetrics, the total "online ...
1
vote
2answers
41 views

How to save JSON with a node

What would be the best way to store JSON content with a node? Can I just use a text field for this or will this destroy the data? I do not need to query this data, only load it occasionally. I'm ...
1
vote
2answers
26 views

How to attach JSON data to JS variable without it being escaped

I'm having so much trouble with drupal 8 right now. when in Drupal 7 I could do: drupal_add_js("var a = 'b';"); and be done with it, for the life of my, I can't figure out how to attach data to a ...
3
votes
2answers
44 views

Parse REST Json replay

I create a views with REST export display, result are serialized with Json, In my formBuild method I want to parse JSON and Convert it to array and use it in select option $host = \Drupal::...
0
votes
0answers
11 views

expose a date filter in a views datasource JSON View

I need to expose a date filter in a JSON View, made with the Views Datasource module, but I can't find any documentation on the matter, I don't even know if it's possible. I know how to do it using ...
1
vote
0answers
12 views

Create content of certain content type based on outside information/validation

I'm running a game server. This server is updated ever so often and I want my players to be informed about the update. I want this to happen automatically. What I have is some JSON output I can query ...
1
vote
0answers
17 views

inserting a date into database with JSONParser module

i have a json file { "student":[{"firstname":"bharath","marks":"80","dateone":"13/09/2014 06:07:08","datetwo":"18/12/2016 09:08:05"}, {"firstname":"purna","marks":"70","dateone":"17/03/2012 ...
1
vote
0answers
67 views

Importing data into Drupal 8

I have various spreadsheets of data to import into Drupal 8. I can create a content type for each spreadsheet. I can convert the data the spreadsheets into various formats (csv, JSON, XML, whatever). ...
2
votes
2answers
122 views

How to use external JSON API to create/update node's fields?

I have a content type: siteinfo. This content type has multiple fields: text, entity reference etc. I want to use an external API to automatically fill some fields of the created node. The API I ...
1
vote
1answer
39 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 ...
0
votes
1answer
39 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
107 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
72 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
25 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 (https://3cwebservices.com/...
0
votes
0answers
29 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
23 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" ,"theme_token":"...
1
vote
0answers
30 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
45 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
35 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
25 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
181 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
48 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
20 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 node,...
0
votes
0answers
29 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
101 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
17 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"}, ...
3
votes
2answers
374 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": "93d5d0a9-...
0
votes
1answer
32 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
16 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
53 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
60 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
68 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
131 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
101 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: https://api.facebook.com/method/fql.query?query=select%20like_count%20from%...
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 "https://www.drupal.org/api-d7/node/...
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
37 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
84 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
78 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
515 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
125 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
28 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 fine,...