I think we’re drifting away a bit from the original question…
filename = '/tmp/theme.dcstyle.json'
File.open(filename) do |file|
json = JSON::parse(file.read)
theme = json['theme']
puts theme
t = Theme.new(name: theme["name"], user_id: -1)
theme["theme_fields"]&.each do |field|
t.set_field(target: field["target"], name: field["name"], value: field["value"])
end
t.save
end