I need to grab json variables from the url a link!
I want to use this data into my wordpress website using www.wordpress.org/plugins/json-data-shortcode
i want to add 2nd "Link" attribute and How to access any attribute in that json file,I am confused because there are lot of "Link" and other attributes repeating more than once
I am new to JSON ,
Please help anyone
I don't think you can because the json object from your link contains a colon ns3:Files.
But if the plugin supports it you can do:
[json src="http://boppanahospitals.com/js/68"]
The link is: {ns3:Files.File[1].Link}
[/json]
Related
I'm working on a website where I want to add the settings of my Slick Slider trough the data-attribute. This is possible with the 'data-slick' attribute. The format for this looks like this: data-slick='{"slidesToShow": 4, "slidesToScroll": 4}'.
In my WordPress CMS I'm using the plugin 'Data Attributes' to add data attributes to a Gutenberg Block. Trough this plugin all double and single quotes are converted to and therefor changes on the frontend to data-slick="{"slidesToShow": 4, "slidesToScroll": 4}"
This is not working. The Slick Slider doesn't use these settings.
Is there another way to add a JSON object into a data-attribute so it will work with the Slick Slider?
Thanks already for your help!
Kind Regards,
Nick
I think storing a JSON value in HTML is a bad idea. There are too many conditions which you have to take into consideration - backend returning page, WEB server encoding (it can add a custom encoding header), and browser compatibility. For this task, I'd prefer 2 ways: bitwise mask or simple function-for example, define a few data attributes -data-s1, data-s2, data-sn. In the JS code, add an array [ data-s1, data-s2, data-sn]. And finally, add a loop with an in-condition (if data.contains(element of array) - read and then parse the data inside of the attribute). I never worked with wordpress but for JS it is a easy task. If you need example write comment below. I can update my answer
I am using html-pdf for pdf creation on my project. i can generate all the details into the pdf. but the thing is i can not be able to create List of items in array in html(which will be used for pdf conversion).
Since i cannot use javascript to get the array of items, i am unable to get it. if there is a tweak to use javascript in html template,please post it here. Since the array of items is known, i can use it easily.
Suppose if the array length is 3 . i can use like array[0].name ,array[1].name, array[2].name but here i don't know the length of the array which consists of how many items. Can anyone please help me here to generate the table of items which is generating dynamically.
You cannot use Javascript in template, but you can use Javascript on it.
The idea is to make a parser which will :
read your template
replace a keywork (for example : <customTable arrayName="myCustomArray" fields="['name']" />) with a generated HTML array in Node.js.
use this template with html-parser.
I write an example of parser in VanillaJS here : https://jsfiddle.net/rbuuzcre/5/
I would like my webpage to display what resembles JASON Parser
does (right panel). I first installed JSONView on my Chrome.
Then I composed a string {"isbn":"asdf","name":"qwer","price":1} which I fed to JSON Parser and made sure it indeed obeyed JSON format.
Eventually, I attempted to display it on my webpage by doing:
out.println("{\"isbn\":\"asdf\",\"name\":\"qwer\",\"price\":1}\");
but it was simply displayed like any other normal String instead of being formatted like this.
How do I manage to make my webpage automatically display JSON formatted?
Thanks!
Edit: I didn't realise this was JSP. The answer I'm giving relates to using the JavaScript method JSON.stringify() which you'd somehow achieve within client-side JavaScript within your JSP project.
Use JSON.stringify() to 'pretty-print' the original JavaScript object.
For example, to have two spaces of indentation:
var str = JSON.stringify(obj, null, 2);
If this has to be achieved within Java code then you could use the GSON library. Example: Pretty-Print JSON in Java
So I am fairly new to working with iOS applications and I am currently working on an application which pulls data from a website using NSURLSessionDataTask, parses the JSON response (HTML), and then populates a view with data from the response.
Currently, I am stuck trying to find a solution to correctly parsing my current HTML string (of type __NSCFString/NSString) from the JSON response, and putting the text into one or more UITextViews and images into one or more UIImageViews within the main ViewController.
It has previously been suggested to simply use a UIWebView to display everything or to use an outside library to do some of the converting, however I am curious if there are any methods by which I could parse the HTML and extract all relevant text or images and throw them into an array for later use. I would very much prefer to keep all of this native and not use outside libraries unless absolutely necessary.
I have also seen some use of the NSAttributedString class for parsing HTML from a JSON response, but am unsure if this is even relevant to what I am trying to do here. Any help/suggestions/thoughts are appreciated!
You can use the native NSXMLParser class. Checkout the documentation here.
Within your custom parsing class. You can generate NSAttributedString and store into array based on custom logic. This should help.
I get some data on html/php page from database. And I edit it. But I want that data to change automatically without refreshing when I edit and click submit button. I have read that I must use json. But I can't add json values into html tags.
How can I do it ?
If you could not understand me, see this video.
You can use javascript to fetch the json file and manipulate the DOM accordingly. The example you provided uses jquery. Jquery provides a couple of ways to retrieve json data with ajax calls. This is all documented very well. See https://api.jquery.com/jquery.get/