Comment on page
Now we're going to access an API, and manipulate the outputted json. Then we will organise our code so that we, and others, can navigate it easily.
This two-part course will take you on quite a journey: Start with the modules on this page, and the fundamentals of data transformation using CRANQ. We will then progress to wrapping your code in a REST API, so that you, and others, can access your application from the web.
The first lesson in the Data Manipulation introduces mapping - the most frequent dataflow alternative to loops through determining the USD exchange rates of each currency in a crypto wallet.
Though not strictly fundamental transformations, these ways of merging lists are very common. In the provided example they’re used for replacing the keys of a dictionary.
This lesson takes you deeper into the realm of mapping, where items of the result depend on more than just the original items. Without it, it would be difficult to convert each currency to USD, given that rates and amounts are stored in a separate dictionary.
Summing up numbers? It’s an application of reducing. In this lesson we’ll finally get to know how much USD in total the contents of the example crypto wallet are worth.
This lesson introduces filtering - removing items from arrays and dictionaries. Some special items need special treatment! For example, converting USDT to USDT.
Now it's time to name your code, and group it, in a way that it's easy for yourself, or others, to understand and maintain. This final lesson in the Data Manipulation series shows off one of CRANQ's best features, the ability to create comprehensible code