Editor is adding some charecters when using .json format

When I edit the JSON file that was saved using the editor, I see it added some characters at each side. How can I fix it?

this is how it looks like when do vi on the file.

{^M"cluster" : [^M {^M

hi @kvkeerthi,

Please share the file in question or a sample of the file that demonstrates the issue.
First guess is this is a line ending issue. Are you sure it’s only json files this is happening in?

  • Carey

Yes this for JSON files only

@kvkeerthi, Please share the file, not an image :slight_smile:

it is not allowing me to share the file.

Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif

This is the config

{
“cluster” : [
{
“id”: “henon”,
“parameters” : {
“domain”: “henon.com”,
“subnet_mask”: “255.255.255.0”,
“gateway”: “1.1.1.254”,
“provision”: {
“server_4”: {
},
“server”: {
},
}
}
}
]
}

You can rename the file to end with .txt but those are line endings. You’re likely going from Linux to Windows or vice versa.

Depending on which one it is, you can set the appropriate line endings for the file in question by right clicking the file tab in Komodo > File Preferences: Line Endings.

  • Carey

Here’s a stackoverflow post of a user having the same issue:

I am doing this on my MAC not using windows. Even it is not allowing to upload .txt files.

where should I apply those changes? Can you share any screenshot please.

Sure, here’s a gif showing you where that preference is:

You’re right, I’m mixing up github with our forums. I guess you can’t upload anything but visual media here. Sorry for the confusion.

Nope, it did not helped me.

Please provide more information. What did you do? What was the setting? What did you attempt after changing the setting if you changed it?

Assuming that you changed the line endings, you can’t just set the pref then expect the line endings to change. They are characters in the file and therefore aren’t added until you type something, ie. Enter. Based on the above assumption try Code menu > Clean line endings`

I did tried DOS and also MAC.

That should fix it.

wow, that helped me. Thank you Careyh.

You are the man.

1 Like

Awesome! Glad I could help.