Catalog.json: Difference between revisions
Line 53: | Line 53: | ||
=== Key data binary format === | === Key data binary format === | ||
''Keys'' are mostly string values that identify a ''bucket'' uniquely. They are only used by ''buckets'', and are not used by any other part of the format. Compared to UTF-8 and UTF-16 keys, very few keys actually use numeric values. For example, in ''[[Rizline:Rizline|Rizline]]'', as of [[Rizline:Asset Version 20.1.2.7.1fd57802dc|Asset Version 20.1.2.7.1fd57802dc]], the <code>catalog_catalog.json</code> file contains 2879 keys; out of them, 2828 keys are in UTF-8, 42 keys are UTF-16 (these are keys that include non-[[Wikipedia:ASCII|ASCII]] characters), and only 9 keys are numeric. | |||
{{DataStructure| | {{DataStructure| | ||
Line 58: | Line 60: | ||
{{DataStructureField|keys|array|A list of keys. The length of the list can be determined by either using the <code>key_count</code> field, or reading until the end of the binary data.| | {{DataStructureField|keys|array|A list of keys. The length of the list can be determined by either using the <code>key_count</code> field, or reading until the end of the binary data.| | ||
{{DataStructureField||struct|A key. The size of the struct is variable.| | {{DataStructureField||struct|A key. The size of the struct is variable.| | ||
{{DataStructureField|key_type|uint8|1-byte number, indicating the type of the key. Known key types are: <code>0</code> - UTF-8 key; <code>1</code> - UTF-16 key; <code>4</code> - int32 key.}} | {{DataStructureField|key_type|uint8|1-byte number, indicating the type of the key. Known key types are: <code>0</code> - [[Wikipedia:UTF-8|UTF-8]] key; <code>1</code> - [[Wikipedia:UTF-16|UTF-16]] key; <code>4</code> - int32 key.}} | ||
{{DataStructureField|key_content|union|| | {{DataStructureField|key_content|union|| | ||
{{DataStructureField|text_content|sized string struct|Only present if key type is <code>0</code> or <code>1</code>. The type of the string is UTF-8 if <code>key_type</code> is <code>0</code> and UTF-16 (little-endian) if <code>key_type</code> is <code>1</code>. This field is the key's name. See [[#Sized string binary format]] for details.}} | {{DataStructureField|text_content|sized string struct|Only present if key type is <code>0</code> or <code>1</code>. The type of the string is UTF-8 if <code>key_type</code> is <code>0</code> and UTF-16 (little-endian) if <code>key_type</code> is <code>1</code>. This field is the key's name. See [[#Sized string binary format]] for details.}} |