# Storing Plugin Data Revisited (Wall Presets)

**URL:** <https://forums.sketchup.com/t/storing-plugin-data-revisited-wall-presets/170813>\
**Category:** Ruby API\
**Created:** [July 22, 2021, 5:42am UTC](https://forums.sketchup.com/t/storing-plugin-data-revisited-wall-presets/170813 "2021-07-22T05:42:08Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Neil\_Burkholder](https://avatars.discourse-cdn.com/v4/letter/n/f4b2a3/32.png) [@Neil\_Burkholder](https://forums.sketchup.com/u/Neil_Burkholder)\
**Post date:** [July 22, 2021, 11:08am UTC](https://forums.sketchup.com/t/storing-plugin-data-revisited-wall-presets/170813/8 "2021-07-22T11:08:48Z")

</div>

I use plain text json in my plugin. It is still pretty easy to read in a text editor, but much easier to parse.

Here you can see how I can handle some or all of my settings being missing.

```ruby
@settings_path = ENV['GEM_PATH'].split('SketchUp')[0] + "#{extension_name}/"
  def read_settings
    settings_file = @settings_path + 'settings.json'
    if File.exist?(settings_file)
      begin
        json = File.open(settings_file, 'r', &:read)
        @settings = JSON.parse(json)
        restore_default_settings unless @settings
        restore_colors unless @settings.key?('colors')
        restore_default_colors unless @settings.key?('default_colors')
        restore_default_building_specs unless @settings.key?('default_building')
        restore_default_preferences unless @settings.key?('preferences')
        restore_default_trim_widths unless @settings.key?('trim_widths')
        restore_default_sb_preferences unless @settings.key?('sb_preferences')
        change_trim_widths(@settings['trim_widths'].to_json, false)
      rescue StandardError => _e
        restore_default_settings
      end
    else
      restore_default_settings
    end
    read_openings
  end

```

With json it is very easy handle situations where ‘old’ settings files are missing properties.

```auto
data['key'] ||= default_value

```

---

_[View the full topic](https://forums.sketchup.com/t/storing-plugin-data-revisited-wall-presets/170813)._
