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

How to remove double quotes? #93

Open
ghost opened this issue Jan 13, 2021 · 4 comments
Open

How to remove double quotes? #93

ghost opened this issue Jan 13, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Jan 13, 2021

How to remove double quotes? // ""

example:
fmt.Println(url.Path("name"))

"root"

@ghost
Copy link
Author

ghost commented Jan 13, 2021

Now I adopt a temporary plan:

example:
replaceAll := strings.ReplaceAll(value, """, "")

@Jeffail
Copy link
Owner

Jeffail commented Feb 22, 2021

Hey @orbwalker, I'm not sure I understand what you're aiming to do here, any chance you can add more details?

@IBMRob
Copy link

IBMRob commented Mar 7, 2021

I'm seeing this as well i.e. if I have the following json object

{"type":"basicAuth","username":"mockuser","password":"mockpass"}

if you were to have code such as

barAuthParsed, err := gabs.ParseJSON(contents)
log.Println(barAuthParsed.Path("type").String())

The output includes the quote marks i.e. "basicAuth". Normally you would expect the value to just return basicAuth

@Jeffail
Copy link
Owner

Jeffail commented Mar 8, 2021

Oh I see, the method .String on a *gabs.Container returns the underlying data as a JSON marshalled string. If your goal is to access the underlying data as a Go string then you need to access that underlying data with .Data() and then use a type check: barAuthParsed.Path("type").Data().(string)

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

2 participants