{"action":"created","issue":{"url":"https://api.github.com/repos/okamstudio/godot/issues/1348","labels_url":"https://api.github.com/repos/okamstudio/godot/issues/1348/labels{/name}","comments_url":"https://api.github.com/repos/okamstudio/godot/issues/1348/comments","events_url":"https://api.github.com/repos/okamstudio/godot/issues/1348/events","html_url":"https://github.com/okamstudio/godot/issues/1348","id":57196729,"number":1348,"title":"Data dump is unclear","user":{"login":"Spooner","id":159180,"avatar_url":"https://avatars.githubusercontent.com/u/159180?v=3","gravatar_id":"","url":"https://api.github.com/users/Spooner","html_url":"https://github.com/Spooner","followers_url":"https://api.github.com/users/Spooner/followers","following_url":"https://api.github.com/users/Spooner/following{/other_user}","gists_url":"https://api.github.com/users/Spooner/gists{/gist_id}","starred_url":"https://api.github.com/users/Spooner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spooner/subscriptions","organizations_url":"https://api.github.com/users/Spooner/orgs","repos_url":"https://api.github.com/users/Spooner/repos","events_url":"https://api.github.com/users/Spooner/events{/privacy}","received_events_url":"https://api.github.com/users/Spooner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-02-10T16:18:29Z","updated_at":"2015-02-10T17:58:26Z","closed_at":null,"body":"Dumping data to strings is very bad. It is often not clear at all what type you are printing out.\r\n\r\n1) Numbers: \"2\" and 2 are printed the same (2). This is fine when writing the value directly in print, but not when it is part of a more complex data structure such as an array or dictionary.\r\n\r\n2) Dictionaries: Format isn't terrible, but it is completely different than the code to create it for no reason. e.g. {\"fish\": \"frog\", \"cheese\": \"pie\" } = (fish:frog), (cheese:pie)\r\n\r\n3) Arrays: Format isn't terrible, but it is completely different from code, which makes it very ambiguous. e.g. printing 1, [1] and [\"1\"] all give the same output.\r\n\r\nOther examples of ambiguity:\r\n{ \"cheese\": \"pie\", \"fish\": \"frog\" } =  (cheese:pie), (fish:frog)\r\n[{\"fish\": \"frog\"}, {\"cheese\": \"pie\" }] =  (cheese:pie), (fish:frog)\r\n\r\nColor(1, 1, 1) = 1, 1, 1, 1\r\n[1, 1, 1, 1] = 1, 1, 1, 1\r\n[[1, 1], [1, 1]] = 1, 1, 1, 1\r\n\r\nVector2(1, 2) = 1, 2\r\n[1, 2] = 1, 2\r\n[\"1\", \"2] = 1, 2\r\n\"1, 2\" = 1, 2\r\n[\"1, 2\"] = 1, 2\r\n\r\nI suggest one of two options:\r\n\r\n1) Following the Python standard (and any other language that outputs complex types as strings):\r\n* Printing string, int, real directly (so no quotes around strings).\r\n* Printing Array, Dictionary, in a meaningful way, exactly the same as they'd be written in code, with nested \r\n* Printing Vector2, Vector3, Color in a meaningful way related to the class, e.g. Vector(22.2, 4), Color(0.1, 0.2, 1, 1)\r\n\r\nCurrently, this is the output provided by Variant::get_construct_string(), but that is only used in the editor hints. For some reason, elsewhere only the \r\n\r\n2) As an alternative, how about a repr() function, as in Python, that gives us the get_construct_string() output, rather than the mostly useless (for non-basic types) String() operator output...\r\n\r\n(I'm happy to implement this stuff; just want to see which you want or will accept)."},"comment":{"url":"https://api.github.com/repos/okamstudio/godot/issues/comments/73748750","html_url":"https://github.com/okamstudio/godot/issues/1348#issuecomment-73748750","issue_url":"https://api.github.com/repos/okamstudio/godot/issues/1348","id":73748750,"user":{"login":"Spooner","id":159180,"avatar_url":"https://avatars.githubusercontent.com/u/159180?v=3","gravatar_id":"","url":"https://api.github.com/users/Spooner","html_url":"https://github.com/Spooner","followers_url":"https://api.github.com/users/Spooner/followers","following_url":"https://api.github.com/users/Spooner/following{/other_user}","gists_url":"https://api.github.com/users/Spooner/gists{/gist_id}","starred_url":"https://api.github.com/users/Spooner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Spooner/subscriptions","organizations_url":"https://api.github.com/users/Spooner/orgs","repos_url":"https://api.github.com/users/Spooner/repos","events_url":"https://api.github.com/users/Spooner/events{/privacy}","received_events_url":"https://api.github.com/users/Spooner/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T17:58:26Z","updated_at":"2015-02-10T17:58:26Z","body":"I have a Level object filled with Tile objects (these are just data objects, not nodes in the world). Wanted to serialize the level and the tiles it contains too in one operation (currently I do this manually, which works fine, but seems cumbersome). This is what I'm trying to ask for in #1349 - this output of strings issue is just for debugging data structures (and has nothing to do with serialization)."}}