Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested arrays? #8

Open
KleBoR opened this issue Oct 24, 2019 · 3 comments
Open

nested arrays? #8

KleBoR opened this issue Oct 24, 2019 · 3 comments

Comments

@KleBoR
Copy link

KleBoR commented Oct 24, 2019

Hi,

would it be possible to extend the module with the feature of handling nested arrays?
actually after parsing i get a (object Object) even if i point to the right key :/

thank you!

@timdows
Copy link
Owner

timdows commented Oct 24, 2019

Can you post an example of your json?

@KleBoR
Copy link
Author

KleBoR commented Oct 24, 2019

sure:

[
  {
    "ident": "5852962e00277ea193369928",
    "brand": "Total",
    "name": "Total",
    "street": "Prenzlauer Allee 1-4",
    "zip": "10405",
    "city": "Berlin",
    "lat": 52.5287907,
    "lng": 13.4179807,
    "highway": false,
    "services": "car_repair,convenience_store,car_wash",
    "distance": "1.314",
    "is_open": true,
    "fuels": [
      {
        "kind": "SuperPlus",
        "price": 1.469,
        "update_date_time": "Heute, 08:22",
        "forecast": {
          "_id": "58541cef4bfdaafea8362a2a",
          "forecast_at": "2019-10-24T07:01:25+00:00",
          "fuel_type": "superplus",
          "short_text": "Tanken Sie <br><b>18 - 21 UHR</b>",
          "text": "Tanken Sie <br><b>VON 18 - 21 UHR</b>",
          "trend": -1
        }
      }
    ],
    "best_distance": true,
    "best_price": true
  },
  {
    "ident": "5852962e00277ea19336993e",
    "brand": "Total",
    "name": "Total",
    "street": "Holzmarktstraße 36",
    "zip": "10243",
    "city": "Berlin",
    "lat": 52.511254,
    "lng": 13.428832,
    "highway": false,
    "services": "car_repair,convenience_store,cell_phone,car_wash",
    "distance": "1.883",
    "is_open": true,
    "fuels": [
      {
        "kind": "SuperPlus",
        "price": 1.519,
        "update_date_time": "Heute, 08:02",
        "forecast": {
          "_id": "58541cef4bfdaafea8362a2a",
          "forecast_at": "2019-10-24T07:01:25+00:00",
          "fuel_type": "superplus",
          "short_text": "Tanken Sie <br><b>18 - 21 UHR</b>",
          "text": "Tanken Sie <br><b>VON 18 - 21 UHR</b>",
          "trend": -1
        }
      }
    ]
  },

and so on..

im just able to access the keys like "ident", "brand" etc.. but not actually the keys "kind" or "update_date_time"

EDIT: i know theres a fuel model, but the accessed api just provides very less fuel types ;)

@masonhensley
Copy link

Was thinking about the same issue. Use case to include stripe api events... (sample data)

Would be cool to loop on data, then in each row show the following columns...

row 1:

  • "data"[0]."data"."object"."object"
  • "data"[0]."object"."amount"

row 2:

  • "data"[1]."data"."object"."object"
  • "data"[1]."object"."amount"

...etc

Totally understand if this is out of scope. 🤓 Cool project by the way!

{
  "object": "list",
  "data": [
    {
      "id": "evt_1FdnExFVjAtnqiQsq4RMsFoI",
      "object": "event",
      "api_version": "2019-05-16",
      "created": 1573518495,
      "data": {
        "object": {
          "object": "balance",
          "available": [
            {
              "amount": 0,
              "currency": "usd",
              "source_types": {
                "card": 0
              }
            }
          ],
          "livemode": false,
          "pending": [
            {
              "amount": 0,
              "currency": "usd",
              "source_types": {
                "card": 0
              }
            }
          ]
        }
      },
      "livemode": false,
      "pending_webhooks": 0,
      "request": {
        "id": null,
        "idempotency_key": null
      },
      "type": "balance.available"
    },
    {
      "id": "evt_1FdRxvFVjAtnqiQsGEQDdtm2",
      "object": "event",
      "api_version": "2019-05-16",
      "created": 1573436715,
      "data": {
        "object": {
          "id": "po_1FdRxQFVjAtnqiQsZAgVfVEP",
          "object": "payout",
          "amount": 8649,
          "arrival_date": 1573516800,
          "automatic": true,
          "balance_transaction": "txn_1FdRxQFVjAtnqiQsQLwU9H3x",
          "created": 1573436684,
          "currency": "usd",
          "description": "STRIPE PAYOUT",
          "destination": "ba_1EjUq6FVjAtnqiQsJOs9hst3",
          "failure_balance_transaction": null,
          "failure_code": null,
          "failure_message": null,
          "livemode": false,
          "metadata": {
          },
          "method": "standard",
          "source_type": "card",
          "statement_descriptor": null,
          "status": "in_transit",
          "type": "bank_account"
        }
      },
      "livemode": false,
      "pending_webhooks": 0,
      "request": {
        "id": null,
        "idempotency_key": null
      },
      "type": "payout.paid"
    },
    {
      "id": "evt_1FdRxuFVjAtnqiQs6rcxDIkX",
      "object": "event",
      "api_version": "2019-05-16",
      "created": 1573436714,
      "data": {
        "object": {
          "id": "po_1FdRxQFVjAtnqiQsZAgVfVEP",
          "object": "payout",
          "amount": 8649,
          "arrival_date": 1573516800,
          "automatic": true,
          "balance_transaction": "txn_1FdRxQFVjAtnqiQsQLwU9H3x",
          "created": 1573436684,
          "currency": "usd",
          "description": "STRIPE PAYOUT",
          "destination": "ba_1EjUq6FVjAtnqiQsJOs9hst3",
          "failure_balance_transaction": null,
          "failure_code": null,
          "failure_message": null,
          "livemode": false,
          "metadata": {
          },
          "method": "standard",
          "source_type": "card",
          "statement_descriptor": null,
          "status": "in_transit",
          "type": "bank_account"
        }
      },
      "livemode": false,
      "pending_webhooks": 0,
      "request": {
        "id": null,
        "idempotency_key": null
      },
      "type": "payout.created"
    }
  ],
  "has_more": true,
  "url": "/v1/events"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants