class Lutaml::Json::Adapter::OjAdapter
def self.parse(json, _options = {})
def self.parse(json, _options = {}) require "oj" Oj.load(json) rescue LoadError raise LoadError, "oj gem is not available. Please add 'oj' to your Gemfile or use the StandardAdapter." end
def to_json(*args)
def to_json(*args) require "oj" # Handle KeyValueElement input (new symmetric architecture) attributes_to_serialize = if @attributes.is_a?(Lutaml::KeyValue::DataModel::Element) # Unwrap __root__ wrapper to get actual content @attributes.to_hash["__root__"] else # Legacy Hash input (backward compatibility) @attributes end Oj.dump(attributes_to_serialize, *args) # rubocop:enable Style/ArgumentsForwarding rescue LoadError raise LoadError, "oj gem is not available. Please add 'oj' to your Gemfile or use the StandardAdapter." end