The JSON is valid – the special here is that the structure starts with an array. Maybe that’s causing the error? Or the unnamed element in the “type” array?
Just my 2 cents
Plugin Author
berkux
(@berkux)
Hi,
web_line is right. Yet an object is expected by the plugin, not an array.
In the next version this will work. Hoepfully this will be on friday.
Plugin Author
berkux
(@berkux)
Hi sactobla,
there is a new version 1.1.0:
https://downloads.wp.xz.cn/plugin/json-content-importer.1.1.0.zip
Before I release it as “stable” I would be happy with some user-tests.
New is the very much enhanced template-engine for supporting more JSON-structures.
Try with
http://openstates.org/api/v1/bills/?state=dc&q=taxi&apikey=4680b1234b1b4c04a77cdff59c91cfe7
the following:
“{title}, {chamber}
{subloop-array:type:4}{0}{/subloop-array:type}<hr>”
Best
Bernhard
Bernard:
I tested it just now and I”m still getting the “unsupported” message. I used first the example you suggested. I also tried it just with the “title” and “Chamber” fields, without the sub loop argument. Both returned the same error. Plug-in page is showing that i’ve installed version 1.1.0.
Plugin Author
berkux
(@berkux)
Found the Error: In the URL to retrieve “&” was unicoded by wordpress to “& # 38 ;”.
http://openstates.org/ does not like that, therefore the plugin has to un-unicode that.
sorry, next plugin-version in a few days…
So, I re-tested it just now and it does work…IF you paste the code into the “text” window of the page editor, not the WYSIWYG editor. Perhaps one solution is to allow the user to define the URL of the JSON on the plugin page and then call that URL in the short code using a user-defined word. (for example with two fields, one the URL and one the user’s name for that url). Of course you’d have to allow for multiple URLs.
Plugin Author
berkux
(@berkux)
Hi sactobla,
here we go:
1. Install
https://downloads.wp.xz.cn/plugin/json-content-importer.1.1.1.zip
2. Try:
[jsoncontentimporter url=”http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7″%5D{committee}
{id}
{subloop-array:all_ids:144}allids: {0}
{/subloop-array:all_ids}
list of sources:
{subloop-array:sources:1}{url}
{/subloop-array:sources}
list of members:
{subloop-array:members:2}{name}
{/subloop-array:members}
[/jsoncontentimporter]
and
[jsoncontentimporter url=”http://openstates.org/api/v1/bills/?state=dc&q=taxi&apikey=4680b1234b1b4c04a77cdff59c91cfe7″%5D{title}, {chamber}
{subloop-array:type:4}{0}{/subloop-array:type}<hr>[/jsoncontentimporter]
is this what you need?
does it work?
Fantastic! Yes. That is it!
Thank you!