Skip to content
Advertisement

Tag: json

How to display accented words JSON on bash script with Python

I’m trying to display arrays with accent in the result but only arrays that don’t have accent are showing. Complete themoviedb API: https://api.themoviedb.org/3/movie/566525?api_key=b2f8880475c888056b6207067fbaa197&language=pt-BR Shell code: result: Answer Here is a cleaner way to do this in jq. This solution also scales better (you don’t need to know the number of elements in your array)

How to use multistep mrjob with json file

I’m trying to use hadoop to get some statistics from a json file like average number of stars for a category or language with most reviews. To do this I am using mrjob, I found this code: It allows to find the most used word, but I am not sure how to do this with json attributes instead of words.

Convert a CSV into a JSON using a JSON Schema

How do I convert a flat table into a JSON? I have previously converted JSONs into Flat Tables using both custom code and libraries. However, what I am aiming to do here is the reverse. Before going ahead and creating a custom library, I was wondering if anyone had encountered this problem before and if there was an existing solution

How can I convert Json data that coming from Postman convert into Integers in python?

Here I’ve wrote a python script using MQL5 to get total history order from MetaTrader5. here’s the code, what my requirement is I need to get from_date and to_date parameter from user. so I passed these parameter from Postman Using POST request.here is the payload And it says, history_orders = mt.history_orders_total(datetime(fromDate), datetime(toDate)) TypeError: an integer is required (got type str)

How to get json text by request with header details?

I would like to go to page https://losoviny.iamroot.eu/part_one and write json text from there. End at first I must login in https://losoviny.iamroot.eu/part_one_login and use details in header. But if If I run code I see: raise JSONDecodeError(“Expecting value”, s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Do you know how to rewrite it? (Header data

How do I apply my function to all the values within a JSON file?

I have a JSON file with the following data: Whereby I want my output to be as follows: This is the code that I currently have, however it only works for the first part of the JSON file and does not iterate over all the other values: When I do run the above code the output is as follows: Question

deserialize json with objects

In python 3, how can I deserialize an object structure from json? Example json: Here’s my python code: How to force some_object to be of type B and some_list_of_objects to be of type list of C? Answer As you’re using Python 3, I would suggest using dataclasses to model your classes. This should improve your overall code quality and also

How to search a dictionary and append a field to JSON by key value?

I am trying to write a script like this in Python: Let’s say I have two JSON files, one has a data structure like this : fruitswithprice.json the other is fruitsnoprice.json I want to append the price field to fruitsnoprice.json for every entry that the key “fruit” matches. I tried this : getting an error at wInList[‘price’] == word[‘price’]. Answer

Advertisement