# What's the easiest way to modify .json files?

**URL:** <https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376>\
**Category:** The Toolbox\
**Created:** [May 22, 2013, 9:48am UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376 "2013-05-22T09:48:57Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shoes](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@Shoes](https://discourse.cataclysmdda.org/u/Shoes)\
**Post date:** [May 22, 2013, 9:48am UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/1 "2013-05-22T09:48:57Z")

</div>

Reason I ask is because only about two items fit on the screen at once for editing. If I want to do a mass change, it would take a bit of time to scroll around to add each line. Is there a way to like… export to excel or something?

---

<div class="post-metadata">

**Author:** ![i2amroy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/i2amroy/32/909_2.png) [@i2amroy](https://discourse.cataclysmdda.org/u/i2amroy)\
**Post date:** [May 22, 2013, 10:23am UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/2 "2013-05-22T10:23:49Z")

</div>

Could you do a mass find/replace to automatically add it throughout the file?

---

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 22, 2013, 11:25am UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/3 "2013-05-22T11:25:26Z")

</div>

open it up in notepad++.

Use the find and replace hotkey for your your operating system.

Done.

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 22, 2013, 9:09pm UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/4 "2013-05-22T21:09:59Z")

</div>

We don’t have a good JSON editor, other than simply using your standard text editor. But if someone finds or makes a good way to edit 'em, by all means, do share!

---

<div class="post-metadata">

**Author:** ![Shoes](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@Shoes](https://discourse.cataclysmdda.org/u/Shoes)\
**Post date:** [May 23, 2013, 1:14pm UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/5 "2013-05-23T13:14:46Z")

</div>

In clothing, if a line is absent, does its value default to 0?

For example, instead of having the line “cutting : 0”, will its absence imply that its value is 0?

---

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 23, 2013, 1:48pm UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/6 "2013-05-23T13:48:34Z")

</div>

[quote=“Shoes, post:5, topic:1376”]In clothing, if a line is absent, does its value default to 0?

For example, instead of having the line “cutting : 0”, will its absence imply that its value is 0?[/quote]

No, you need all the lines or you will get an error.

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [May 23, 2013, 7:00pm UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/7 "2013-05-23T19:00:28Z")

</div>

[quote=“drake1storm, post:6, topic:1376”][quote=“Shoes, post:5, topic:1376”]In clothing, if a line is absent, does its value default to 0?

For example, instead of having the line “cutting : 0”, will its absence imply that its value is 0?[/quote]

No, you need all the lines or you will get an error.[/quote]

This actually depends on the value. Any attributes that are “optional” have appropriate defaults, but I don’t think cutting is one of them (item flags for example, however, are)

Basically, if it needs a value, it’s probably required, even if that value would be zero.

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 23, 2013, 8:54pm UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/8 "2013-05-23T20:54:37Z")

</div>

But, it does call debugmsg for any required attributes that are missing. If you don’t get any debugmsg spam upon game load, then you should have all the required attributes.

---

<div class="post-metadata">

**Author:** ![Shoes](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@Shoes](https://discourse.cataclysmdda.org/u/Shoes)\
**Post date:** [May 23, 2013, 10:01pm UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/9 "2013-05-23T22:01:29Z")

</div>

Anyway to make most fields default to a certain something? I feel like that would improve immensely on readability.

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 23, 2013, 10:10pm UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/10 "2013-05-23T22:10:53Z")

</div>

Not without changing the item factory code, no.

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [May 24, 2013, 4:27am UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/11 "2013-05-24T04:27:30Z")

</div>

Although I /did/ have almost all of them have defaults in the original version of that code, that was all lost when someone switched it over to catajson. 😛

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 24, 2013, 8:11am UTC](https://discourse.cataclysmdda.org/t/whats-the-easiest-way-to-modify-json-files/1376/12 "2013-05-24T08:11:38Z")

</div>

“Defaults” that emitted error messages :P.

It would be handy, though, to make more things (explicitly) optional; I just don’t want to be in a state where we’re telling modders that certain errors can be safely ignored.
