Rooyca / obsidian-api-request

Obsidian plugin that allows you to make requests to API's and receive responses in codeblocks or store them in localStorage.
https://rooyca.github.io/obsidian-api-request/
MIT License
78 stars 4 forks source link

Parse arrays in the response as bullet points #14

Closed rishFilet closed 1 month ago

rishFilet commented 2 months ago

Is your feature request related to a problem? Please describe. When I get a response, I cannot parse it since it is in an array. I notice you can write the number and then the key eg. 0 -> name but this only gives me one element at a time

Describe the solution you'd like I'd like to be able to parse each element in the array and then extract one/many values of a key and place them in a bulleted list to start with

Describe alternatives you've considered Writing a block for each element in the array but I have more than 20 elements

Additional context Add any other context or screenshots about the feature request here.

Rooyca commented 2 months ago

Hey @rishFilet!

So you have a response like this:

[
  {
    "userId": 1,
    "id": 1,
    "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
    "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
  },
  {
    "userId": 1,
    "id": 2,
    "title": "qui est esse",
    "body": "est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla"
  },
  {
    "userId": 1,
    "id": 3,
    "title": "ea molestias quasi exercitationem repellat qui ipsa sit aut",
    "body": "et iusto sed quo iure\nvoluptatem occaecati omnis eligendi aut ad\nvoluptatem doloribus vel accusantium quis pariatur\nmolestiae porro eius odio et labore et velit aut"
  }
]

And you would like an output like this:

Which is a list of all the title's.