JSON array to dataframe

R programming language resources Forums Data manipulation JSON array to dataframe

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #487
    vmgmax
    Member

    Hi,

    I am somewhat new to R and trying to test out an API service. I have been able to pull the data from the service using Rcurl, the data returned is a JSON array structure. While I know there are two json packages, I can not seem to get the array into a dataframe without getting an error. Here is a sample of the data returned:

    { “1234”: { “id”: 1234, “ref_no”: “1234”, “external_account_id”: 1234, “store_id”: 0, “store_name”: “test”, “added_timestamp”: “2012-03-28T00:00:00”, “name”: “test”, “icon”: “http://test.png”, “active”: true, “hidden”: false, “sku”: “1234”, “in_apps”: [1234,1234,1234,1234], “product_type”: “app”, “addons”: [] },
    { “1234”: { “id”: 1234, “ref_no”: “1234”, “external_account_id”: 1234, “store_id”: 0, “store_name”: “test”, “added_timestamp”: “2012-03-28T00:00:00”, “name”: “test”, “icon”: “http://test.png”, “active”: true, “hidden”: false, “sku”: “1234”, “in_apps”: [], “product_type”: “app”, “addons”: [] }}

    Ideally, I would want all the labels “id”, to be column headers, one problem is occasionally there are mutliple values for some fields:

    “in_apps”: [1234,1234,1234,1234]
    “in_apps”: []

    Any thoughts or pointers would be greatly welcomed.

    #489
    bryan
    Participant

    vmgmax,

    I don’t have a direct answer to your question, but this video talks indirectly about combining R and Javascript via JSON. It may give you some answers or ideas.

    http://www.youtube.com/watch?v=7x0UdUghANI&hd=1

    Bryan

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Scroll to top
Privacy Policy