mirror of
				https://gitlab.com/hashborgir/d2tweaks-rnd2k.git
				synced 2025-10-31 17:03:40 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			349 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			349 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <iostream>
 | |
| #include <nlohmann/json.hpp>
 | |
| 
 | |
| using json = nlohmann::json;
 | |
| 
 | |
| int main()
 | |
| {
 | |
|     json j;
 | |
|     j["address"]["street"] = "Fake Street";
 | |
|     j["address"]["housenumber"] = "12";
 | |
| 
 | |
|     try
 | |
|     {
 | |
|         int housenumber = j["address"]["housenumber"];
 | |
|     }
 | |
|     catch (json::exception& e)
 | |
|     {
 | |
|         std::cout << e.what() << '\n';
 | |
|     }
 | |
| }
 |