Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to convert zero prepended integer from YAML file to YAML object using “yaml.Unmarshal” #66

Open
AnilPetnaktoa opened this issue Oct 8, 2020 · 0 comments

Comments

@AnilPetnaktoa
Copy link

AnilPetnaktoa commented Oct 8, 2020

Hello experts,

Would like to know how to convert zero prepended integer( i.e octal integer) number from YAML file to YAML Object.
Tried with yaml.v3 also but could see same results.

Any help would be appreciates

zero prepended integer examples:

01
001
00002 and so

Sample program
==============

package main

import "fmt"
import "gopkg.in/yaml.v2"

var data = a: 01 b: 1

func main() {
var obj interface{}
_ = yaml.Unmarshal([]byte(data), &obj)
fmt.Println("YAML data:", data)
fmt.Println("OBJ:", obj)
}_

O/p of above program:

===================
YAML data:
a: 01
b: 1
OBJ: map[a:1 b:1]

justinsb pushed a commit to justinsb/yaml that referenced this issue Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant