minji's study log

  • 홈
  • 태그
  • 방명록

kotlinx-serialization 1

Kotlinx Serialization의 JsonBuilder Properties 알아보기

프로젝트에서 서버 통신 후 받은 Response를 문자열(String)으로 웹뷰에 전달해야하는 일이 있어서 kotlinx-serialization의 StringFormat.encodeToString(value: T): String을 사용했다. 그런데 서버에서 전달된 값이 객체에 잘 저장이 되고 있었음에도 불구하고 encodeToString를 하면 키-값이 모두 사라져있는 것이었다. 😱 // 이런 상황이었다. (예시) @Serializable data class Foo( val a: Int = 0, val b: Int = 0, ) val response = Foo(a = 42, b = 0) Json.encodeToString(response) // {"a": 42} // 오잉 b는 어디갔지 ㄴㅇㄱ ?? 결..

Kotlin 2023.02.23
이전
1
다음
더보기
프로필사진

  • 분류 전체보기
    • Android
      • Coroutine
      • Jetpack Compose
      • UI(XML)
    • Kotlin
    • Book
    • Life
      • 동아리
      • 사이드 프로젝트

Tag

android, Kotlin, cleartop, 안드로이드, classDiscriminator, kotlinx-serialization, useAlternativeNames, isLenient, 위임패턴, ViewCompositionStrategy, 핸드폰 번호 인증, 인증 문자, Delegation Pattern, allowSpecialFloatingPointValues, PhoneNumber Auth, encodeDefaults, ignoreUnknownKeys, prettyPrint, explicitNulls, allowStructuredMapKeys,

최근글과 인기글

  • 최근글
  • 인기글

방문자수Total

  • Today :
  • Yesterday :

최근댓글

Calendar

«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Copyright © Kakao Corp. All rights reserved.

티스토리툴바