U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » Jsonize problems with maps
Jsonize problems with maps [message #36002] Wed, 18 April 2012 09:11 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

There's a problem with maps jsonization.
Small example:
#include <Core/Core.h>
using namespace Upp;

struct TestStruct
{
	VectorMap<String,String> map;
	void Jsonize(JsonIO &json)
	{
		json("map",map); //compile error!
	}
};

CONSOLE_APP_MAIN
{
	StoreAsJson(TestStruct());
}


Actually, I found 2 problems with jsonizing the Maps.
1) It doesn't actually compile (strange!)
2) Even if it compiled, json representation of such map is not optimal. IMO there must be special version for maps with string keys. It will make possible using native json way for representing such maps:
{ "key1":value1, "key2":value2, ... }

[Updated on: Wed, 18 April 2012 09:15]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Little problem in util.cpp and simple solution
Next Topic: LoadFromXMLFile() proposal when file is not found
Goto Forum:
  


Current Time: Sun Apr 26 13:33:37 GMT+2 2026

Total time taken to generate the page: 0.00764 seconds