Item deserialize fail with unnecessary escaped double quote

Me again, serialization problem again.

I think this should be an issue:
When serialize a written_book by code from previous topic, some data will use unnecessary escaped double quote. This issue will cause fail when deserialize, AND, this issue will not present when the book is in a shulker box. This problem only happen when get the string back from database and deserialize it.

Error message:

[22:14:07] [Server thread/ERROR] [STDERR]: java.io.IOException: com.typesafe.config.ConfigException$Parse: Reader: 15: expecting a close brace or a field name here, got '\' (Reserved character '\' is not allowed outside quotes)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at ninja.leaping.configurate.loader.AbstractConfigurationLoader.load(AbstractConfigurationLoader.java:171)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at ninja.leaping.configurate.loader.ConfigurationLoader.load(ConfigurationLoader.java:42)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at ***.deserialize(***.java:391)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at ***(***.java:364)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at ***(***.java:65)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at org.spongepowered.common.event.listener.***.handle(Unknown Source)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:305)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:319)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:133)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(SourceFile:1407)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.server.management.PlayerList.func_72355_a(SourceFile:1173)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.server.network.NetHandlerLoginServer.func_147326_c(SourceFile:120)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.server.network.NetHandlerLoginServer.func_73660_a(SourceFile:66)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.network.NetworkManager.func_74428_b(SourceFile:232)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.network.NetworkSystem.func_151269_c(SourceFile:187)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.server.MinecraftServer.func_71190_q(SourceFile:1603)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(SourceFile:335)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.server.MinecraftServer.func_71217_p(SourceFile:562)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at net.minecraft.server.MinecraftServer.run(SourceFile:466)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at java.lang.Thread.run(Unknown Source)
[22:14:07] [Server thread/ERROR] [STDERR]: Caused by: com.typesafe.config.ConfigException$Parse: Reader: 15: expecting a close brace or a field name here, got '\' (Reserved character '\' is not allowed outside quotes)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseError(ConfigDocumentParser.java:201)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseError(ConfigDocumentParser.java:197)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseKey(ConfigDocumentParser.java:278)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseObject(ConfigDocumentParser.java:397)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseValue(ConfigDocumentParser.java:247)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.consolidateValues(ConfigDocumentParser.java:152)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseArray(ConfigDocumentParser.java:498)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseValue(ConfigDocumentParser.java:249)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.consolidateValues(ConfigDocumentParser.java:152)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseObject(ConfigDocumentParser.java:420)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseValue(ConfigDocumentParser.java:247)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseObject(ConfigDocumentParser.java:405)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseValue(ConfigDocumentParser.java:247)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.consolidateValues(ConfigDocumentParser.java:152)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseArray(ConfigDocumentParser.java:542)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseValue(ConfigDocumentParser.java:249)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.consolidateValues(ConfigDocumentParser.java:152)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parseObject(ConfigDocumentParser.java:420)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser$ParseContext.parse(ConfigDocumentParser.java:595)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.ConfigDocumentParser.parse(ConfigDocumentParser.java:14)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.Parseable.rawParseValue(Parseable.java:260)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.Parseable.rawParseValue(Parseable.java:248)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:180)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.impl.Parseable.parse(Parseable.java:299)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at com.typesafe.config.ConfigFactory.parseReader(ConfigFactory.java:668)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at ninja.leaping.configurate.hocon.HoconConfigurationLoader.loadInternal(HoconConfigurationLoader.java:104)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at ninja.leaping.configurate.hocon.HoconConfigurationLoader.loadInternal(HoconConfigurationLoader.java:54)
[22:14:07] [Server thread/ERROR] [STDERR]: 	at ninja.leaping.configurate.loader.AbstractConfigurationLoader.load(AbstractConfigurationLoader.java:163)
[22:14:07] [Server thread/ERROR] [STDERR]: 	... 20 more
[22:14:07] [Server thread/ERROR] [Sponge]: Could not pass ClientConnectionEvent$Join$Impl to Plugin{id=***, name=***, version=***, description=***, source=mods\***.jar}
java.lang.NullPointerException: node
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229) ~[minecraft_server.1.11.2.jar:?]
	at org.spongepowered.common.data.persistence.ConfigurateTranslator.translateFromNode(ConfigurateTranslator.java:70) ~[ConfigurateTranslator.class:1.11.2-6.0.0-BETA-249]
	at org.spongepowered.common.data.persistence.ConfigurateTranslator.translate(ConfigurateTranslator.java:124) ~[ConfigurateTranslator.class:1.11.2-6.0.0-BETA-249]
	at org.spongepowered.common.data.persistence.ConfigurateTranslator.translate(ConfigurateTranslator.java:46) ~[ConfigurateTranslator.class:1.11.2-6.0.0-BETA-249]
	at ***.deserialize(***.java:396) ~[***.class:?]
	at ***(***.java:364) ~[***.class:?]
	at ***(***.java:65) ~[***.class:?]
	at org.spongepowered.common.event.listener.***.handle(Unknown Source) ~[?:?]
	at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:1.11.2-6.0.0-BETA-249]
	at org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:305) [SpongeEventManager.class:1.11.2-6.0.0-BETA-249]
	at org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:319) [SpongeEventManager.class:1.11.2-6.0.0-BETA-249]
	at org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:133) [SpongeImpl.class:1.11.2-6.0.0-BETA-249]
	at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(SourceFile:1407) [mt.class:?]
	at net.minecraft.server.management.PlayerList.func_72355_a(SourceFile:1173) [mt.class:?]
	at net.minecraft.server.network.NetHandlerLoginServer.func_147326_c(SourceFile:120) [mk.class:?]
	at net.minecraft.server.network.NetHandlerLoginServer.func_73660_a(SourceFile:66) [mk.class:?]
	at net.minecraft.network.NetworkManager.func_74428_b(SourceFile:232) [er.class:?]
	at net.minecraft.network.NetworkSystem.func_151269_c(SourceFile:187) [mh.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(SourceFile:1603) [MinecraftServer.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(SourceFile:335) [lh.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(SourceFile:562) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.run(SourceFile:466) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_71]

Serialized string output on console:

ContentVersion=1
Count=1
Data=[
    {
        DataClass="org.spongepowered.common.data.manipulator.mutable.item.SpongeAuthorData"
        ManipulatorData {
            BookAuthor="{\"text\":\"***\"}"
            ContentVersion=1
        }
    },
    {
        DataClass="org.spongepowered.common.data.manipulator.mutable.item.SpongePagedData"
        ManipulatorData {
            BookPages=[
                "{\"text\":\"{\\\"text\\\":\\\"d\\\"}\"}"
#issue in this line.
            ]
            ContentVersion=1
        }
    },
    {
        DataClass="org.spongepowered.common.data.manipulator.mutable.item.SpongeGenerationData"
        ManipulatorData {
            ContentVersion=1
            Generation=0
        }
    }
]
ItemType="minecraft:written_book"
UnsafeDamage=0
UnsafeData {
    author=***
    pages=[
        "{\"text\":\"d\"}"
    ]
    title=d
}

Serialized string stored in Database:

ContentVersion=1
Count=1
Data=[
    {
        DataClass="org.spongepowered.common.data.manipulator.mutable.item.SpongeAuthorData"
        ManipulatorData {
            BookAuthor="{"text":"***"}"
            ContentVersion=1
        }
    },
    {
        DataClass="org.spongepowered.common.data.manipulator.mutable.item.SpongePagedData"
        ManipulatorData {
            BookPages=[
                "{"text":"{\"text\":\"d\"}"}"
#issue in this line.
            ]
            ContentVersion=1
        }
    },
    {
        DataClass="org.spongepowered.common.data.manipulator.mutable.item.SpongeGenerationData"
        ManipulatorData {
            ContentVersion=1
            Generation=0
        }
    }
]
ItemType="minecraft:written_book"
UnsafeDamage=0
UnsafeData {
    author=***
    pages=[
        "{"text":"d"}"
    ]
    title=d
}

In case when written_book is in a shulker box and output it’s serialized string on console:

ContentVersion=1
Count=1
ItemType="minecraft:white_shulker_box"
UnsafeDamage=0
UnsafeData {
    BlockEntityTag {
        Items=[
            {
                Count=1
                Damage=0
                Slot=0
                id="minecraft:written_book"
                tag {
                    author=***
                    pages=[
                        "{\"text\":\"d\"}"
                    ]
                    title=d
                }
            }
        ]
    }
}

This issue can be solve by using PreparedStatement to store it to database with it’s exactly appearance.
So now, I’m not sure this is or not an issue.