Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6197221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:46:53+00:00 2026-05-24T03:46:53+00:00

I have complex data structure, like this: OrderedHash, keys are dates and values are

  • 0

I have complex data structure, like this: OrderedHash, keys are dates and values are ordered hashes which hold integers with string keys. I need to serialize those in order to store in db. But after to_yaml/YAML.load data is sometimes broken — some of second-level hashes are replaced with first-level or vice-versa. Sometimes it is not broken, though.

yaml representation looks like this

- 2011-07-10: !omap 
    - 00:00-01:00: 0
    - 01:00-02:00: 0
    - 02:00-03:00: 0
    - 03:00-04:00: 0
    - 04:00-05:00: 0
    - 05:00-06:00: 0
    - 06:00-07:00: 0
    - 07:00-08:00: 0
    - *id010
    - 09:00-10:00: 0
    - 10:00-11:00: 0
    - 11:00-12:00: 0
    - 12:00-13:00: 0
    - 13:00-14:00: 0
    - 14:00-15:00: 0
    - 15:00-16:00: 0
    - 16:00-17:00: 0
    - 17:00-18:00: 0
    - 18:00-19:00: 0
    - 19:00-20:00: 0
    - 20:00-21:00: 0
    - 21:00-22:00: 0
    - 22:00-23:00: 0
    - 23:00-23:59: 0

This *id010/&id010 part gets randomly inserted in different places of yaml code. I think it’s the cause of error.

Does anybody have the idea of what is wrong with yaml serialization?
ruby 1.8.6, upgrade to 1.9 isn’t an option 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:46:54+00:00Added an answer on May 24, 2026 at 3:46 am

    It’s very possible there is a bug. I believe the YAML engine Ruby 1.8 uses is called Syck, and this code was created by _why many years ago. The code has not been properly maintained since then.

    Ruby 1.9 is supposed to use a new engine called Psych, but I am not sure how compatible this is with Ruby 1.8.

    On Github I also found another alternative, which looks like it might be worth a try for you:
    https://github.com/cesare/ruby-libc-libyaml

    Syck (you might try this version, since it looks like it’s being semi-maintained):
    https://github.com/indeyets/syck

    Psych (you could also try and see if this runs on 1.8):
    https://github.com/tenderlove/psych


    EDIT

    Perhaps JSON could be an alternative for you also? Take a look at the to_json method and see if that could be used for your purposes, and perhaps circumvent the YAML problems this way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a complex Clojure data structure that I would like to serialize -
I have a data structure that represents C# code like this: class Namespace: string
I have a rather complex data structure I've implemented in Perl. This has been
I have a very complex data structure, something like 10 tables without the join
Assuming Visual C/C++ 6, I have a complex data structure of 22399 elements that
I have a ViewModel with a kinda complex data structure. I need my view
I have a complex command that I'd like to make a shell/bash script of.
I have a complex WPF UserControl made of other ContentControl templates which contain sets
I'm integrating some code into my library. It is a complex data structure well
I have a web page that I use to update a fairly complex data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.