can you paste here exactly what you are receiving in the responseContent (before any conversion)?
Not a screenshot of your responseContent, but the content of the responseContent. Check here how do it and then paste here the received response:
How to show raw responseContent from your app when debugging - Tutorials and Guides - MIT App Inventor Community
like this?
[{"id":654515,"image":"https://img.spoonacular.com/recipes/654515-312x231.jpg","imageType":"jpg","likes":1,"missedIngredientCount":2,"missedIngredients":[{"aisle":"Produce","amount":5,"id":2004,"image":"https://img.spoonacular.com/ingredients_100x100/bay-leaves.jpg","meta":["(from my garden)"],"name":"pandan leaves click here cut to 2" length","original":"5 Pandan leaves click here (from my garden) cut to 2" length","originalName":"Pandan leaves click here (from my garden) cut to 2" length","unit":"","unitLong":"","unitShort":""},{"aisle":"Nut butters, Jams, and Honey","amount":6,"id":19296,"image":"https://img.spoonacular.com/ingredients_100x100/honey.png","meta":["to taste"],"name":"honey or","original":"6 tablespoons Honey or to taste","originalName":"Honey or to taste","unit":"tablespoons","unitLong":"tablespoons","unitShort":"Tbsp"}],"title":"Pandan Smoothie","unusedIngredients":,"usedIngredientCount":2,"usedIngredients":[{"aisle":"Produce","amount":100,"id":11206,"image":"https://img.spoonacular.com/ingredients_100x100/cucumber.jpg","meta":["cut into small cubes"],"name":"cucumber","original":"100 grams Cucumber, cut into small cubes","originalName":"Cucumber, cut into small cubes","unit":"grams","unitLong":"grams","unitShort":"g"},{"aisle":"Produce","amount":3,"id":9200,"image":"https://img.spoonacular.com/ingredients_100x100/orange.png","meta":["peeled","quartered"],"name":"oranges","original":"3 Oranges, peeled and quartered","originalName":"Oranges, peeled and quartered","unit":"","unitLong":"","unitShort":""}]}, {"id":639512,"image":"https://img.spoonacular.com/recipes/639512-312x231.png","imageType":"png","likes":7,"missedIngredientCount":4,"missedIngredients":[{"aisle":"Produce","amount":2,"id":11959,"image":"https://img.spoonacular.com/ingredients_100x100/arugula-or-rocket-salad.jpg","meta":,"name":"arugula","original":"2 cups arugula","originalName":"arugula","unit":"cups","unitLong":"cups","unitShort":"cup"},{"aisle":"Produce","amount":2,"id":11429,"image":"https://img.spoonacular.com/ingredients_100x100/radishes.jpg","meta":["thinly sliced"],"name":"radish","original":"2 radish, thinly sliced","originalName":"radish, thinly sliced","unit":"","unitLong":"","unitShort":""},{"aisle":"Produce","amount":1,"id":11291,"image":"https://img.spoonacular.com/ingredients_100x100/spring-onions.jpg","meta":["chopped"],"name":"green onion","original":"1 green onion, chopped","originalName":"green onion, chopped","unit":"","unitLong":"","unitShort":""},{"aisle":"Seafood","amount":8,"id":10015172,"image":"https://img.spoonacular.com/ingredients_100x100/scallops.jpg","meta":,"name":"scallops","original":"8 scallops","originalName":"scallops","unit":"","unitLong":"","unitShort":""}],"title":"Citrus Arugula Salad with Seared Scallops","unusedIngredients":,"usedIngredientCount":2,"usedIngredients":[{"aisle":"Produce","amount":1,"id":9200,"image":"https://img.spoonacular.com/ingredients_100x100/orange.png","meta":,"name":"cara cars orange","original":"1 cara cars orange","originalName":"cara cars orange","unit":"","unitLong":"","unitShort":""},{"aisle":"Produce","amount":0.5,"extendedName":"english persian cucumber","id":10111205,"image":"https://img.spoonacular.com/ingredients_100x100/english-cucumber.png","meta":["english","thinly sliced","(or cucumber)"],"name":"persian cucumber","original":"1/2 persian cucumber (or english cucumber), thinly sliced","originalName":"persian cucumber (or english cucumber), thinly sliced","unit":"","unitLong":"","unitShort":""}]}]
I don't know what to do with it, this is exactly how i received it from the spoonacular API . is the issue with the Api itself or my app
You can try to manipulate the response received to delete all those malformed parts:
the question is if for other request you will have responses with other weird fields....
For example, with the above example of @ABG this example will not work...
(EDIT: I have changed the example by other more generic)
Other option could be extract the info directly from the response string but this can be quite cumbersome depending on the information you want to extract.
I'm so sorry, I made a mistake. These fields without values are due to the fact that when you copied the JSON that you have left, the empty fields [ ] have been pasted as and then they have not been pasted correctly in my example. Apologies. By removing that part of "length" you should be able to decode it correctly:
Thank you for your reply buddy. Will this work though for different recipes? since my app will take different variables based on the users preferences and have the API retrieve recipes for them. I will continue working on my app and i will see if your code fixes the problem.<333
Looking to the @ABG examples:
name": "pandan leaves click here cut to 2\" length",
you can se the double quotes after the 2 are escaped (2 \ ")...in what you have pasted that double quotes are not escaped (2").
This difference is why you have to put that first additional block removing "length "".
But if your response have that double quoted escaped like in the other examples (maybe other error copy-pasting) then you don't need that additional block.
It is important to find out that because what works for one scenario will not work for the other so, try without the additional block:
I will try both and tomorrow I will show you the results. thanks! <33
Sorry for the mistakes...
I found the recipe JSON unparseable using the DecodeJSONAsDictionaries block, but the older DecodeJSON block was able to parse it without errors, albeit into lists of pairs.
So here is some rudimentary browsing and display code:
spoonacular.aia (7.5 KB)
I leave it up to you to prettify the output.
One last note about spoonacular recipes.
I didn't see anything about preparation instructions.
Maybe they just do salads?
don't say that friend! you've done more than enough to help me thank you! <33
I think its because the ingredients that i use for this app are mostly fruits and veggies.
I really want to thank you guys @ABG @nishyanthkumar @Kevinkun @Ramon for helping me so much with this and being so kind too! i want to show you were i got, and i think you'll be very proud! i managed to translate the Json text after organizing it like you showed me and now i can receive the titles and the steps of the recipies like i wanted i will show you the code and the screen (in the companion app):
up until here it all works like a charm! and i think i am finally understand the basic of dealing with dictionaries the only problem i may be facing is splitting the recipes apart (their titles and steps("original") i am currently working on fixing that wish me luck!
this is the screen :
Once i am done with this app i will put the entire app (.aia) here so everyone can use it and i will add your names for your help!
(added to FAQ)