Adding field to_string/from_string methods that encode to JSON/YAML strings.

Parameterized test as well. Converting to actual parameterized test wil allow removing `_assert_from_string_is_nan`, so it makes more sense to employ parameterized tests here