Creating a api to return JSON

Is there a way to create an endpoint to where I make a Request to it with a JSON body with a “amount” key and a number value and then have the Runkit endpoint return a JSON response with the formatted value. I was looking at these examples Thank you
Then endpoint example

currency conversion

Hi @lukejamison,

Take a look at this example I made for you:

To see it in action, you can post something like:



Let me know if you have any other questions!

1 Like

Your awesome @pieter that works perfectly!! is there any way to pass an array to the endpoint so that i could send multiple values such as
{ "amount": [{ "value": 124 }, { "value": 3422 } ] }
let me know if you have any questions thank you so much! really appreciate it

Happy to hear that I’ve answered your question, @lukejamison. I’m always happy to help with questions specific to RunKit, but if you’re looking to learn more of JavaScript’s built-in functions, I cannot recommend MDN Web Docs highly enough.

For example, you could look at the documentation for loops and iteration in JavaScript or perhaps, if you want to work with an array of amount values.

You can see examples of each approach at this RunKit Notebook:

Thank you for the help on that information. I will take a look at that documentation. Another question is what is the easiest way to make an api call and return specific keys form the JSON response in Runkit?

Hello @pieter how can I make a Api call in runKit and then define the JSON response and then save that data to a GET Runkit endpoint?