The invention provides a templated format
conversion method and
system for hierarchical
metadata, and relates to the technical field of
data format conversion, and the method comprises the following steps: receiving a
metadata file in a
JSON format; the method comprises the following steps of: recursively analyzing a
metadata file in a
JSON format, verifying fields of the metadata file in a manner of combining a structure tree model with a category
label suspension mark, if the fields have an STRUCT structure
body type, traversing all fields in an STRUCT structure body to generate a tree-shaped
data structure, and if the fields have an ARRAY array type, traversing all fields in an ARRAY array to generate a tree-shaped
data structure; if the field is of a basic field type, traversing the basic field to generate a set type
data structure, and if the field is of a basic field type, traversing the basic field to generate a specific type data structure; the
XML format file is generated according to different types of data structures, and the complete
hierarchical relation of the original
JSON format metadata file is reserved. The problems that in the prior art, unique complex types of metadata cannot be automatically processed, and nested structure output is not supported are solved.