com.alibaba.fastjson2.JSONArray.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastjson2-kotlin Show documentation
Show all versions of fastjson2-kotlin Show documentation
kotlin integration for Fastjson2
The newest version!
@file:Suppress(
"HasPlatformType"
)
package com.alibaba.fastjson2
/**
* E.g.
* ```
* val data = "...".parseArray()
* val users = data.to()
* ```
*
* @return [T]?
* @since 2.0.3
*/
inline fun JSONArray.to() =
to(T::class.java)
/**
* Implemented using [TypeReference]
*
* E.g.
* ```
* val data = "...".parseArray()
* val users = data.into>()
* ```
*
* @return [T]?
* @since 2.0.3
*/
inline fun JSONArray.into() =
to(reference().getType())
/**
* E.g.
* ```
* val data = "...".parseArray()
* val users = data.to(6)
* ```
*
* @return [T]?
* @since 2.0.4
*/
inline fun JSONArray.to(
index: Int,
vararg features: JSONReader.Feature
) = getObject(
index, T::class.java, *features
)
/**
* Implemented using [TypeReference]
*
* E.g.
* ```
* val data = "...".parseArray()
* val users = data.into