This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "profiles": [ | |
| { | |
| "complex_modifications": { | |
| "parameters": { "basic.to_if_alone_timeout_milliseconds": 700 }, | |
| "rules": [ | |
| { | |
| "description": "Auto close brackets & quotes ( (), '', \"\", ``, [], {}, “”, ‘’, <> )", | |
| "enabled": false, | |
| "manipulators": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [escape]>[caps] | |
| [caps]>[null] | |
| [lctrl]>[lwin] | |
| [rwin]>[lctrl] | |
| [rctrl]>[lwin] | |
| [lshift]>[null] | |
| [home]>[home][t&h50][lshift] | |
| [pup]>[pup][t&h50][lshift] | |
| [rshift]>[null] | |
| [end]>[end][t&h50][escape] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun `play around with useArrayPolymorphism`() { | |
| @Serializable | |
| abstract class Animal | |
| @Serializable | |
| @SerialName("Dog") // Overrides name to 'Dog' instead of fully qualified class name for runtime | |
| data class Dog(val lovesTreats: Boolean) : Animal() | |
| @Serializable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun `allowStructuredMapKeys allows json with non-primitive keys to be parsed successfully`() { | |
| @Serializable | |
| data class Contacts( | |
| val contacts: Map<Int, Map<Map<Int, Int>, String>> | |
| ) | |
| val contacts = Contacts( | |
| linkedMapOf( | |
| 1 to mapOf(mapOf(1 to 1) to "Gurpreet"), | |
| 2 to linkedMapOf(mapOf(2 to 2) to "value") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun `pretty printing JSON with custom indent is also an option`() { | |
| val user = User(1, "Gurpreet Singh") | |
| val json = Json(JsonConfiguration(prettyPrint = true, indent = " ")) | |
| .stringify(User.serializer(), user) | |
| assertEquals( | |
| """{ | |
| | "id": 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun `pretty printing JSON is an option`() { | |
| val user = User(1, "Gurpreet Singh") | |
| val json = Json(JsonConfiguration(prettyPrint = true)) | |
| .stringify(User.serializer(), user) | |
| assertEquals( | |
| """{ | |
| | "id": 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun `'unquotedPrint' isn't effective if strings have spaces`() { | |
| val user = User(1, "Gurpreet Singh") | |
| val json = Json(JsonConfiguration(unquotedPrint = true)) | |
| .stringify(User.serializer(), user) | |
| assertEquals("""{id:1,name:"Gurpreet Singh"}""", json) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun `JSON keys and values are unquoted if 'unquotedPrint' flag is true`() { | |
| val user = User(1) | |
| val json = Json(JsonConfiguration(unquotedPrint = true)) | |
| .stringify(User.serializer(), user) | |
| assertEquals("""{id:1,name:N/A}""", json) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun `allow serializing special floating point values with 'serializeSpecialFloatingPointValues'`() { | |
| @Serializable | |
| data class User( | |
| val id: Float, | |
| val name: String = "N/A" | |
| ) | |
| val userJsonWithInfinityId = """{"id":Infinity,"name":"Gurpreet"}""" | |
| val userJsonWithNaNId = """{"id":NaN,"name":"Gurpreet"}""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun `serialization passes for malformed JSON if 'isLenient' flag is true`() { | |
| val userJson = """ {id:1,name:Gurpreet} """ | |
| val parsedObject = Json(JsonConfiguration(isLenient = true)) | |
| .parse(User.serializer(), userJson) | |
| assertEquals(User(1, "Gurpreet"), parsedObject) | |
| } |
NewerOlder