git clone https://github.com/nlohmann/json.git
cd json
git checkout feature/manual_lexer
### Keybase proof | |
I hereby claim: | |
* I am nlohmann on github. | |
* I am nlohmann (https://keybase.io/nlohmann) on keybase. | |
* I have a public key whose fingerprint is 7971 67AE 41C0 A6D9 232E 4845 7F3C EA63 AE25 1B69 | |
To claim this, I am signing this object: |
Hi there, | |
I am wondering whether JSON [RFC7159] support would be a helpful extension to the C++ standard library (pure library extension), including, but not limited to, the following aspects: | |
1. A variant-like container type (for this mail, let's call it "std::json") that combines C++ types for the JSON value types [RFC7159, chapter 3]: | |
- string (e.g. std::string), | |
- number (e.g., double or int64_t), | |
- boolean (e.g., bool), | |
- array (e.g., std::vector), and | |
- object (e.g., std::map). |
def remove_empty_elements(d): | |
"""recursively remove empty lists, empty dicts, or None elements from a dictionary""" | |
def empty(x): | |
return x is None or x == {} or x == [] | |
if not isinstance(d, (dict, list)): | |
return d | |
elif isinstance(d, list): | |
return [v for v in (remove_empty_elements(v) for v in d) if not empty(v)] |