相关文章推荐
沉稳的汉堡包  ·  Hive(17) Hive的常用函数 - ...·  2 年前    · 
从未表白的遥控器  ·  飞桨PaddlePaddle的个人空间 - ...·  3 年前    · 
聪明伶俐的脆皮肠  ·  pod卡住terminating排查记录_p ...·  3 年前    · 
威武的煎饼  ·  iRegulon:从基因列表到调控网络 - 知乎·  3 年前    · 
性感的酱牛肉  ·  springboot设置接口超时 - ...·  3 年前    · 
小百科  ›  cn.hutool.json.JSONArray.<init> java code examples | Tabnine
string jsonarray
豪气的哑铃
3 年前
congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
JSONArray.<init>
Code Index Add Tabnine to your IDE (free)

How to use
cn.hutool.json.JSONArray
constructor

Best Java code snippets using cn.hutool.json . JSONArray . <init> (Showing top 20 results out of 315)

origin: looly / hutool

/**
 * JSON字符串转JSONArray
 * @param arrayOrCollection 数组或集合对象
 * @return JSONArray
 * @since 3.0.8
public static JSONArray parseArray(Object arrayOrCollection) {
  return new JSONArray(arrayOrCollection);
origin: looly / hutool

/**
 * JSON字符串转JSONArray
 * @param arrayOrCollection 数组或集合对象
 * @return JSONArray
 * @since 3.0.8
public static JSONArray parseArray(Object arrayOrCollection) {
  return new JSONArray(arrayOrCollection);
origin: looly / hutool

/**
 * JSON字符串转JSONArray
 * @param jsonStr JSON字符串
 * @return JSONArray
public static JSONArray parseArray(String jsonStr) {
  return new JSONArray(jsonStr);
origin: looly / hutool

/**
 * 创建 JSONArray
 * @return JSONArray
public static JSONArray createArray() {
  return new JSONArray();
origin: looly / hutool

/**
 * JSON字符串转JSONArray
 * @param arrayOrCollection 数组或集合对象
 * @param ignoreNullValue 是否忽略空值
 * @return JSONArray
 * @since 3.2.3
public static JSONArray parseArray(Object arrayOrCollection, boolean ignoreNullValue) {
  return new JSONArray(arrayOrCollection, ignoreNullValue);
origin: looly / hutool

/**
 * 创建 JSONArray
 * @return JSONArray
public static JSONArray createArray() {
  return new JSONArray();
origin: looly / hutool

/**
 * JSON字符串转JSONArray
 * @param jsonStr JSON字符串
 * @return JSONArray
public static JSONArray parseArray(String jsonStr) {
  return new JSONArray(jsonStr);
origin: looly / hutool

/**
 * JSON字符串转JSONArray
 * @param arrayOrCollection 数组或集合对象
 * @param ignoreNullValue 是否忽略空值
 * @return JSONArray
 * @since 3.2.3
public static JSONArray parseArray(Object arrayOrCollection, boolean ignoreNullValue) {
  return new JSONArray(arrayOrCollection, ignoreNullValue);
origin: looly / hutool

/**





    
 * 获得JSONArray对象<br>
 * 如果值为其它类型对象,尝试转换为{@link JSONArray}返回,否则抛出异常
 * @param key KEY
 * @return JSONArray对象,如果值为null或者非JSONArray类型,返回null
public JSONArray getJSONArray(K key) {
  final Object object = this.getObj(key);
  if(null == object) {
    return null;
  if(object instanceof JSONArray) {
    return (JSONArray) object;
  return new JSONArray(object);
origin: looly / hutool

/**
 * 获得JSONArray对象<br>
 * 如果值为其它类型对象,尝试转换为{@link JSONArray}返回,否则抛出异常
 * @param key KEY
 * @return JSONArray对象,如果值为null或者非JSONArray类型,返回null
public JSONArray getJSONArray(K key) {
  final Object object = this.getObj(key);
  if(null == object) {
    return null;
  if(object instanceof JSONArray) {
    return (JSONArray) object;
  return new JSONArray(object);
origin: looly / hutool

  json = new JSONArray(obj);
} else {// 对象
  json = new JSONObject(obj);
origin: looly / hutool

  json = new JSONArray(obj);
} else {// 对象
  json = new JSONObject(obj);
origin: looly / hutool

/**
 * 将指定KEY列表的值组成新的JSONArray
 * @param names KEY列表
 * @return A JSONArray of values.
 * @throws JSONException If any of the values are non-finite numbers.
public JSONArray toJSONArray(Collection<String> names) throws JSONException {
  if (CollectionUtil.isEmpty(names)) {
    return null;
  final JSONArray ja = new JSONArray();
  Object value;
  for (String name : names) {
    value = this.get(name);
    if (null != value) {
      ja.put(value);
  return ja;
origin: looly / hutool

} 




    
else if (value instanceof Collection) {
  Collection<?> coll = (Collection<?>) value;
  return new JSONArray(coll).toString();
} else if (value.getClass().isArray()) {
  return new JSONArray(value).toString();
} else {
  return JSONUtil.quote(value.toString());
origin: looly / hutool

/**
 * 将指定KEY列表的值组成新的JSONArray
 * @param names KEY列表
 * @return A JSONArray of values.
 * @throws JSONException If any of the values are non-finite numbers.
public JSONArray toJSONArray(Collection<String> names) throws JSONException {
  if (CollectionUtil.isEmpty(names)) {
    return null;
  final JSONArray ja = new JSONArray();
  Object value;
  for (String name : names) {
    value = this.get(name);
    if (null != value) {
      ja.put(value);
  return ja;
origin: looly / hutool

/**
 * 积累值。类似于put,当key对应value已经存在时,与value组成新的JSONArray. <br>
 * 如果只有一个值,此值就是value,如果多个值,则是添加到新的JSONArray中
 * @param key 键
 * @param value 被积累的值
 * @return this.
 * @throws JSONException 如果给定键为<code>null</code>或者键对应的值存在且为非JSONArray
public JSONObject accumulate(String key, Object value) throws JSONException {
  InternalJSONUtil.testValidity(value);
  Object object = this.getObj(key);
  if (object == null) {
    this.put(key, value instanceof JSONArray ? new JSONArray().put(value) : value);
  } else if (object instanceof JSONArray) {
    ((JSONArray) object).put(value);
  } else {
    this.put(key, new JSONArray().put(object).put(value));
  return this;
origin: looly / hutool

/**





    
 * 积累值。类似于put,当key对应value已经存在时,与value组成新的JSONArray. <br>
 * 如果只有一个值,此值就是value,如果多个值,则是添加到新的JSONArray中
 * @param key 键
 * @param value 被积累的值
 * @return this.
 * @throws JSONException 如果给定键为<code>null</code>或者键对应的值存在且为非JSONArray
public JSONObject accumulate(String key, Object value) throws JSONException {
  InternalJSONUtil.testValidity(value);
  Object object = this.getObj(key);
  if (object == null) {
    this.put(key, value instanceof JSONArray ? new JSONArray().put(value) : value);
  } else if (object instanceof JSONArray) {
    ((JSONArray) object).put(value);
  } else {
    this.put(key, new JSONArray().put(object).put(value));
  return this;
origin: looly / hutool

/**
 * 追加值,如果key无对应值,就添加一个JSONArray,其元素只有value,如果值已经是一个JSONArray,则添加到值JSONArray中。
 * @param key 键
 * @param value 值
 * @return this.
 * @throws JSONException 如果给定键为<code>null</code>或者键对应的值存在且为非JSONArray
public JSONObject append(String key, Object value) throws JSONException {
  InternalJSONUtil.testValidity(value);
  Object object = this.getObj(key);
  if (object == null) {
    this.put(key, new JSONArray().put(value));
  } else if (object instanceof JSONArray) {
    this.put(key, ((JSONArray) object).put(value));
  } else {
    throw new JSONException("JSONObject [" + key + "] is not a JSONArray.");
  return this;
origin: looly / hutool

/**
 * 追加值,如果key无对应值,就添加一个JSONArray,其元素只有value,如果值已经是一个JSONArray,则添加到值JSONArray中。
 * @param key 键
 * @param value 值
 * @return this.
 * @throws JSONException 如果给定键为<code>null</code>或者键对应的值存在且为非JSONArray
public JSONObject append(String key, Object value) throws JSONException {
  InternalJSONUtil.testValidity(value);
  Object object = this.getObj(key);
  if (object == null) {
    this.put(key, new JSONArray().put(value));
  } else if (object instanceof JSONArray) {
    this.put(key, ((JSONArray) object).put(value));
  } else {
    throw new JSONException("JSONObject [" + key + "] is not a JSONArray.");
  return this;
origin: looly / hutool

JSONArray jsonArray = new JSONArray();
if (this.nextClean() != '[') {
  throw this.syntaxError("A JSONArray text must start with '['");
cn.hutool.json JSONArray <init>

Javadoc

构造
ArrayList 实现

Popular methods of JSONArray

  • add
  • doWrite
    将JSON内容写入Writer
  • getByPath
  • getObj
  • getStr
  • init
    初始化
  • iterator
  • put
    Append an object value. This increases the array's length by one. 加入元素,数组长度+1,等同于 JSONArray#add(Obj
  • size
  • toJSONString
    转为JSON字符串,指定缩进值
  • toList
    转为 ArrayList
  • toString
    转为JSON字符串,无缩进
  • toList ,
  • toString ,
  • write

Popular in Java

  • Running tasks concurrently on multiple threads
  • getOriginalFilename ( MultipartFile )
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged ( ArrayAdapter )
  • findViewById ( Activity )
  • Color ( java.awt )
    The Color class is used to encapsulate colors in the default sRGB color space or
 
推荐文章
沉稳的汉堡包  ·  Hive(17) Hive的常用函数 - Whatever_It_Takes - 博客园
2 年前
从未表白的遥控器  ·  飞桨PaddlePaddle的个人空间 - OSCHINA - 中文开源技术交流社区
3 年前
聪明伶俐的脆皮肠  ·  pod卡住terminating排查记录_pod terminating_运维Enter的博客-CSDN博客
3 年前
威武的煎饼  ·  iRegulon:从基因列表到调控网络 - 知乎
3 年前
性感的酱牛肉  ·  springboot设置接口超时 - 五色风车 - 博客园
3 年前
Link管理   ·   Sov5搜索   ·   小百科
小百科 - 百科知识指南