Ok, so I have been banging my head against the wall trying to figure out how to pull in select XML or JSON data into my website. I have very limited coding ability so most of what’s online goes a bit over my head. I’ve been reading everything possible. I’ve really found nothing for XML, but two potential solutions for json that I can’t get working.
First is simply using the json_decode command. Problem is, the syntax is too complicated for me.
So I am supposed to type
json_decode ( string $json [, bool $assoc = false [, int $depth = 512 [, int $options = 0 ]]] ) somewhere. Well, where do I put the URI? I assume it is passed through some string, but how? Even better, how do I figure out how to put in the key. Is the key just one word, or does it nest? If it nests, do you put periods between?
Let’s say I figure that out. Would I put this somewhere in my child functions.php? Would I then call it into init? Let’s say I do all that, what would I type into the simple html space of a wordpress post that would display (you programmers call that ‘echoing’?) it in there?
Do I need to use ajax? Do I need to enque a script or something? Not that I know what I just said…
I feel like I almost have it, I just need someone to give me a live example of code including where it goes to make the final leap.
I have also tried to use the JSON Data Shortcode plugin which actually seems simple enough for even me to use, but couldn’t get that to display anything, though at least it kind of made sense. It simply asks me for the key. is there a prefix to the key I need or something? Let’s say that I want “title” that is nested under “feed”. Is the key simply “feed.title”
Or does the plugin not work? Given it has 1 out of 5 stars, I am suspicious.
Any help would be appreciated.
- The topic ‘XML or JSON Parsing’ is closed to new replies.