[seagrant-dev] API endpoint output samples

Evan Tschuy tschuy at osuosl.org
Fri Aug 15 17:17:24 UTC 2014


The way the data was arranged was written based on how easy we were able to
parse it in Python/Javascript, but it's not an issue to make it wrapped in
a list like that. Looking around the internet, it is actually standard
practice to wrap lists in (surprise!) lists as you recommend.

In your above data, putting the objects into a list removes their IDs. I'll
probably add the ID to the vendor/etc objects in the lists to remedy this,
unless you don't find it necessary.

I can have some updated sample data hopefully by the end of the day.

Evan


On Thu, Aug 14, 2014 at 4:44 PM, Freeman, Michael <
Michael.Freeman at oregonstate.edu> wrote:

>  So I looked into importing the json data Evan sent me and I have a small
> blocker. The data is structured in such a way that each vendor or product
> is a root. This makes it hard to populate the Sencha store that I am
> looking at in order to send data to the views. If the items were not
> specific roots I could easily populate my store.
>
>
>
> This is how the Data is sent now:
>
> Note: 24 and 25 are separate objects or “roots” as sencha calls them.
>
> Looking at a specific root this gives me one of the two vendors.
>
> {
>
>                 “24”:{
>
>                                 “name”: “Joe’s Crab Shack”,
>
>                                 “city”: “Newport”,
>
>                                 “updated”: “Wednesday”,
>
>                                 “zip”: “97333”
>
>                 },
>
> “25”:{
>
>                 “name”: “Cody’s Clam Shop”,
>
>                                 “city”: “Gold Beach”,
>
>                                 “updated”: “Wednesday”,
>
>                                 “zip”: “97333”
>
>                 }
>
> }
>
>
>
> If the Data was like this:
>
> Note: One Array or “root” looks at all of the different vendors.
>
> Looking at this root I get both of the vendors.
>
> {
>
>                 “vendors”: [
>
> {
>
>                                 “name”: “Joe’s Crab Shack”,
>
>                                 “city”: “Newport”,
>
>                                 “updated”: “Wednesday”,
>
>                                 “zip”: “97333”
>
>                 },
>
> {
>
>                 “name”: “Cody’s Clam Shop”,
>
>                                 “city”: “Gold Beach”,
>
>                                 “updated”: “Wednesday”,
>
>                                 “zip”: “97333”
>
>                 }
>
> ]
>
> }
>
>
>
> I’m just curious as to why each vendor is a specific object, instead of an
> object inside of an array of related objects. Is that an industry standard?
> Just not sure of how to use the data as it is output at the moment. I can
> get the data to load if I change it into the array format above. If anyone
> can explain it to me a little better that would be nice.
>
>
>
> Thanks,
>
> Michael
>
>
>
>
>
>
>
>
>
> *From:* seagrant-dev-bounces at osuosl.org [mailto:
> seagrant-dev-bounces at osuosl.org] *On Behalf Of *Evan Tschuy
> *Sent:* Wednesday, August 13, 2014 2:19 PM
> *To:* seagrant-dev at osuosl.org
> *Subject:* [seagrant-dev] API endpoint output samples
>
>
>
> I imported some random data and saved the API output with wget so the app
> devs would have something to play with. If you want something with data
> that's a little easier to tell apart, I can send you the sample data that
> I've written but currently there's only two entries for each item.
>
> Evan
>
> _______________________________________________
> seagrant-dev mailing list
> seagrant-dev at osuosl.org
> http://lists.osuosl.org/mailman/listinfo/seagrant-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/seagrant-dev/attachments/20140815/a2fb6cad/attachment.html>


More information about the seagrant-dev mailing list