# Moving away from yaml to (where to.)

**URL:** <https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420>\
**Category:** ruby-talk\
**Created:** [3 September 2013 12:15 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420 "2013-09-03T12:15:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [3 September 2013 12:15 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/1 "2013-09-03T12:15:35Z")

</div>

Hi,

Are there alternatives to yaml files?

I need mostly:

key: value pairs

although the ability to load arrays directly into a .rb file would be  
cool too.

Reason: I can no longer use yaml files in ruby 2.0 if they are not in  
UTF. As I do not use UTF and never will, yet syck has been removed, I  
need another way to load my configuration settings (I use several  
hundred yaml files). Without that I would be forced to not use my  
configuration settings (which is currently in yaml) so upgrading my ruby  
version gives me only drawbacks and extra work and no benefit.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Peter\_Hickman2](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/peter_hickman2/32/1832_2.png) [@Peter\_Hickman2](https://rubytalk.org/u/Peter_Hickman2)\
**Post date:** [3 September 2013 12:32 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/2 "2013-09-03T12:32:29Z")

</div>

Any reason why JSON is not suitable?

> **···**
>
> On 3 September 2013 13:15, Marc Heiler \<lists@ruby-forum.com\> wrote:
> 
> > Hi,
> > 
> > Are there alternatives to yaml files?
> > 
> > I need mostly:
> > 
> > key: value pairs
> > 
> > although the ability to load arrays directly into a .rb file would be  
> > cool too.
> > 
> > Reason: I can no longer use yaml files in ruby 2.0 if they are not in  
> > UTF. As I do not use UTF and never will, yet syck has been removed, I  
> > need another way to load my configuration settings (I use several  
> > hundred yaml files). Without that I would be forced to not use my  
> > configuration settings (which is currently in yaml) so upgrading my ruby  
> > version gives me only drawbacks and extra work and no benefit.
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Lars\_Haugseth1](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@Lars\_Haugseth1](https://rubytalk.org/u/Lars_Haugseth1)\
**Post date:** [3 September 2013 12:53 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/3 "2013-09-03T12:53:20Z")

</div>

The JSON specification at [RFC 4627 - The application/json Media Type for JavaScript Object Notation (JSON)](http://tools.ietf.org/html/rfc4627) states:

&nbsp;&nbsp;"JSON text SHALL be encoded in Unicode. The default encoding is UTF-8."

The original poster stated:

&nbsp;&nbsp;"As I do not use UTF and never will[…]"

I guess that rules out JSON, and a lot of other things besides.  
Good luck, though.

> **···**
>
> On 09/03/2013 02:32 PM, Peter Hickman wrote:
> 
> > Any reason why JSON is not suitable?
> 
> --  
> Lars Haugseth

---

<div class="post-metadata">

**Author:** ![stomar](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stomar](https://rubytalk.org/u/stomar)\
**Post date:** [3 September 2013 16:01 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/4 "2013-09-03T16:01:47Z")

</div>

> Hi,
> 
> Are there alternatives to yaml files?
> 
> I need mostly:
> 
> key: value pairs
> 
> although the ability to load arrays directly into a .rb file would be  
> cool too.

Best option: YAML (surprise)

> Reason: I can no longer use yaml files in ruby 2.0 if they are not in UTF.

???

Yes you can.

ASCII works out of the box (it is valid UTF-8),  
other encodings could be converted before parsing them.

Regards,  
Marcus

> **···**
>
> Am 03.09.2013 14:15, schrieb Marc Heiler:
> 
> --  
> GitHub: [stomar (Marcus Stollsteimer) · GitHub](https://github.com/stomar/)  
> PGP: 0x6B3A101A

---

<div class="post-metadata">

**Author:** ![Eric\_Wong2](https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/32.png) [@Eric\_Wong2](https://rubytalk.org/u/Eric_Wong2)\
**Post date:** [3 September 2013 22:30 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/5 "2013-09-03T22:30:19Z")

</div>

> Hi,
> 
> Are there alternatives to yaml files?
> 
> I need mostly:
> 
> key: value pairs
> 
> although the ability to load arrays directly into a .rb file would be  
> cool too.

You could try to make CSV work for you.

Or just inspect/pp + eval if you want to live dangerously.

> Reason: I can no longer use yaml files in ruby 2.0 if they are not in  
> UTF. As I do not use UTF and never will, yet syck has been removed, I  
> need another way to load my configuration settings (I use several  
> hundred yaml files). Without that I would be forced to not use my  
> configuration settings (which is currently in yaml) so upgrading my ruby  
> version gives me only drawbacks and extra work and no benefit.

YAML can store binary, too. It isn't pretty, but you can continue  
using whatever encoding you want:

> **···**
>
> Marc Heiler \<lists@ruby-forum.com\> wrote:
> 
> ---  
> FOO: !binary |-  
> &nbsp;&nbsp;8Ss3UyKu9iXkSC0=
> 
> --  
> Eric Wong

---

<div class="post-metadata">

**Author:** ![Wayne\_Brisette](https://avatars.discourse-cdn.com/v4/letter/w/91b2a8/32.png) [@Wayne\_Brisette](https://rubytalk.org/u/Wayne_Brisette)\
**Post date:** [3 September 2013 13:34 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/6 "2013-09-03T13:34:06Z")

</div>

I'm wondering about that as well. UTF-8 imposes no penalty if you want to restrict yourself to the basic ASCII character set. Seems like an odd avoidance given the lack of any real penalty.

Wayne

> **···**
>
> On Sep 3, 2013, at 8:31 AM, Peter Hickman wrote:
> 
> > The desire not to use UTF-8 seems to be a religious issue given the the OP has not given any reason or described a problem that they are having with YAML

---

<div class="post-metadata">

**Author:** ![Peter\_Hickman2](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/peter_hickman2/32/1832_2.png) [@Peter\_Hickman2](https://rubytalk.org/u/Peter_Hickman2)\
**Post date:** [3 September 2013 13:31 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/7 "2013-09-03T13:31:24Z")

</div>

If the configuration settings are data structures in the Ruby program then  
you can convert them to and from JSON. The fact that they are encoded with  
UTF-8 is transparent and pretty irrelevant unless the data is in some  
esoteric format (but then how would Ruby handle this anyway?).

The desire not to use UTF-8 seems to be a religious issue given the the OP  
has not given any reason or described a problem that they are having with  
YAML. If they are prepared to convert their current settings files from  
YAML to some other, as yet unspecified, format they could just as easily  
just convert the data to UTF-8 and be done with it.

---

<div class="post-metadata">

**Author:** ![Florian\_Gilcher](https://avatars.discourse-cdn.com/v4/letter/f/57b2e6/32.png) [@Florian\_Gilcher](https://rubytalk.org/u/Florian_Gilcher)\
**Post date:** [3 September 2013 14:29 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/8 "2013-09-03T14:29:44Z")

</div>

Also, YAML is a unicode based format as well and handling other things is a SYCK implementation detail. So, the true quesition is: "moving away from SYCK, where to?"

> **···**
>
> Am 03.09.2013 um 15:34 schrieb Wayne Brissette \<wbrisett@att.net\>:
> 
> > On Sep 3, 2013, at 8:31 AM, Peter Hickman wrote:
> > 
> > > The desire not to use UTF-8 seems to be a religious issue given the the OP has not given any reason or described a problem that they are having with YAML
> > 
> > I'm wondering about that as well. UTF-8 imposes no penalty if you want to restrict yourself to the basic ASCII character set. Seems like an odd avoidance given the lack of any real penalty.
> > 
> > Wayne

---

<div class="post-metadata">

**Author:** ![stomar](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stomar](https://rubytalk.org/u/stomar)\
**Post date:** [3 September 2013 15:58 UTC](https://rubytalk.org/t/moving-away-from-yaml-to-where-to/68420/9 "2013-09-03T15:58:39Z")

</div>

What's wrong with Psych (the default)?

Regards,  
Marcus

> **···**
>
> Am 03.09.2013 16:29, schrieb Florian Gilcher:
> 
> > So, the true quesition is: "moving away from SYCK, where to?"
> 
> --  
> GitHub: [https://github.com/stomar/](https://github.com/stomar/)  
> PGP: 0x6B3A101A
