Popup-Editor - After Save, JSON-String is corrupted

crazyx13th shared this problem 3 years ago
Solved

Hey there,


I have a big Problem with editing "JSON-Strings" (normal string / stringified JSON)


if I modify a value with a double click I can see my beauty formated JSON-Strings, nice...

but if I modify a small part and klick "save" my JSON is corrupted (Uncaught SyntaxError: Unexpected token in JSON at position ...)


example

before:

pure: "{\n\t\"node\":\"LINE1\\rLINE2\"\n}"

nice formated shown inside editor like:


{
	"node":"LINE1
LINE2"
}
after save:


"{\n\t\"node\":\"LINE1\nLINE2\"\n}"


in short: my \\r gets a \n


thanks!


Greetings

crazyx13th

Replies (10)

photo
1

Thank you for your feedback.

We have worked out a new build to resolve this issue, please download and give it a try. Suppose you are using the windows system.

http://s3.mongobooster.com/download/releasesv6/nosqlbooster4mongo-6.2.10-beta.1.exe

photo
1

First view ist very good! Seem to work, but give me some time for real Practice (I had to revert a dump today...)

Thanks!!

photo
1

And yeah, win10-x64 :-)

photo
1

mhh.... working only if a \\r exists :-(


working:


"column-test": "{\n\t\"test-a\": \"LINE1\\nLINE2\",\n\t\"test-b\": \"LINE1\\rLINE2\",\n}",

not working

"column-test": "{\n\t\"test-a\": \"LINE1\\nLINE2\",\n\t\"test-b\": \"LINE1\\nLINE2\",\n}",

after edititing inside the "double-click-pupup" I got

"column-test": "{\n\t\"test-a\": \"LINE1A\nLINE2B\",\n\t\"test-b\": \"LINE1\nLINE2\",\n}",

sorry

thx!

photo
1

I tried again, and there was no error in the data store, but the display looked different when editing.

Because / r is a unique line wrap in the windows system, we have done some special treatment for / r. To put it simply, when / r exists, / n retains the original characters for editing.

When / r is not found, / n is interpreted as a newline character.

photo
1

Hey, thanks for answering.


ok, but this is not the solution, because you MODIFY the original data (a "\\n" gets a "\n" after OPENING edit-popup). I give you a step by step example:

- insert:

db.test.insert([{testValue:"before\\nline-two"}])

- overview:

db.test.find({})
cc1353929022262504d17c7c997f0300

- edit document

56822239ff7e182ebcc4bd421afd2052

All seems to be ok!

7a313b122cae10d9e8b75a819e1af425


- now, I click edit to open the edit-popup

3cbad2bf3f568ca42a58f6dfa4ad5165

- after opening i click save (I did nothing / no manual editing!)

1dca81024850c1067f3383d0efae1276

- overview shows the same as before:

db.test.find({})

b1a3c77f6ecadd4ceb90caeabfbd8328

BUT if I edit the document ...


e53bb65f9a9fa822af0d3eed84097ad5

"\\n" not there, only "\n"

thanks for your support! Hope you will fix this bug! :-)

photo
1

my example before:

a1b84d702b6be40d210376bfc8af011d


db.test.insert([{testValue:"{\n\t\"test-a\": \"LINE1\\nLINE2\",\n\t\"test-b\": \"LINE1\\rLINE2\",\n}"}])

314e5045706f5a6e3dc3835a7b1b62db

this means after your current beta change if a "\\r" apears somewhere all gets fine... a "\\n" is a "\\n" after save


BUT


db.test.insert([{testValue:"{\n\t\"test-a\": \"LINE1\\nLINE2\",\n\t\"test-b\": \"LINE1\\nLINE2\",\n}"}])
32c97cab502c1d1db9000d9229d2a144


The Probleme is at OPENING the popup window he losing one "\"

what I sayed before: a "\\n" gets a "\n"

thanks!


7f39a7ad4359049054ae460b6aaaafd3

6574176182d1ea856305b81b214fd4f4

photo
1

Thank you for your feedback. This problem is really a little more complicated than I thought, and there are still some problems with the text editor's handling of special characters. We have worked out a new test build to try to resolve this issue, please download and give it a try.

http://s3.mongobooster.com/download/releasesv6/nosqlbooster4mongo-6.2.10-beta.2.exe

BTW, you can also use the "edit document" meu item to edit the raw value.

d2b8dc76aff2a68deb7b0f01e23b13cc

photo
1

beta.2 looks perfect! I testet it with 10 huge json-strings (10x ~20k chars)

I will keep an Eye on this (compare before and after the next time), but for now I think you can "close" it.

thanks!!!


"BTW, you can also use the "edit document" meu item to edit the raw value."

yeah, I wrote that in my text :-)

but 10k-50k long json strings are better readable inside the popup-editor ;-)

01883faf463d4a5a628015a4edc7b6b3

photo
1

thx again for quick support,

fyi: since today I'm a "NoSQLBooster for MongoDB Personal License With 3 Years Software Assurance" User!

:-)

photo
1

Thanks for the encouragement.

photo
Leave a Comment
 
Attach a file