Codota Logo
FastJson
Code IndexAdd Codota to your IDE (free)

How to use
FastJson
in
com.jfinal.json

Best Java code snippets using com.jfinal.json.FastJson (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: jfinal/jfinal

  public <T> T parse(String jsonString, Class<T> type) {
    return fastJson.parse(jsonString, type);
  }
}
origin: jfinal/jfinal

public Json getJson() {
  return new FastJson();
}
 
origin: jfinal/jfinal

public String toJson(Object object) {
  // 优先使用对象级的属性 datePattern, 然后才是全局性的 defaultDatePattern
  String dp = datePattern != null ? datePattern : getDefaultDatePattern();
  if (dp == null) {
    return JSON.toJSONString(object);
  } else {
    return JSON.toJSONStringWithDateFormat(object, dp, SerializerFeature.WriteDateUseDateFormat);	// return JSON.toJSONString(object, SerializerFeature.WriteDateUseDateFormat);
  }
}
 
origin: com.jfinal/jfinal-weixin

/**
 * 将 json字符串 转为Object
 * @param jsonString json字符串
 * @param valueType 结果类型
 * @param <T> 泛型标记
 * @return T 结果
 */
public static <T> T parse(String jsonString, Class<T> valueType) {
  if (jsonFactory == null) {
    // return Json.getJson().parse(jsonString, valueType);
      
      Json json = Json.getJson();
      // JFinalJson 不支持 parse
      if (json instanceof com.jfinal.json.JFinalJson) {
        return FastJson.getJson().parse(jsonString, valueType);
      } else {
        return json.parse(jsonString, valueType);
      }
  }
  return jsonFactory.getJson().parse(jsonString, valueType);
}
origin: yangfuhai/jboot

public String createJwtToken(Map map) {
  SecretKey secretKey = generalKey();
  SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
  long nowMillis = System.currentTimeMillis();
  Date now = new Date(nowMillis);
  map.put("isuuedAt", nowMillis);
  String subject = FastJson.getJson().toJson(map);
  JwtBuilder builder = Jwts.builder()
      .setIssuedAt(now)
      .setSubject(subject)
      .signWith(signatureAlgorithm, secretKey);
  if (jwtConfig.getValidityPeriod() > 0) {
    long expMillis = nowMillis + jwtConfig.getValidityPeriod();
    builder.setExpiration(new Date(expMillis));
  }
  return builder.compact();
}
origin: yangfuhai/jboot

public Map parseJwtToken(String token) {
  SecretKey secretKey = generalKey();
  try {
    Claims claims = Jwts.parser()
        .setSigningKey(secretKey)
        .parseClaimsJws(token).getBody();
    String subject = claims.getSubject();
    if (StrUtils.isBlank(subject)) {
      return null;
    }
    return FastJson.getJson().parse(subject, HashMap.class);
  } catch (SignatureException | MalformedJwtException e) {
    // don't trust the JWT!
    // jwt 签名错误或解析错误,可能是伪造的,不能相信
  } catch (ExpiredJwtException e) {
    // jwt 已经过期
  } catch (Throwable ex) {
    //其他错误
  }
  return null;
}
origin: com.jfinal/jfinal

  public <T> T parse(String jsonString, Class<T> type) {
    return fastJson.parse(jsonString, type);
  }
}
origin: jfinal/jfinal

public static FastJson getJson() {
  return new FastJson();
}
 
origin: com.jfinal/jfinal

public String toJson(Object object) {
  // 优先使用对象级的属性 datePattern, 然后才是全局性的 defaultDatePattern
  String dp = datePattern != null ? datePattern : getDefaultDatePattern();
  if (dp == null) {
    return JSON.toJSONString(object);
  } else {
    return JSON.toJSONStringWithDateFormat(object, dp, SerializerFeature.WriteDateUseDateFormat);	// return JSON.toJSONString(object, SerializerFeature.WriteDateUseDateFormat);
  }
}
 
origin: com.jfinal/jfinal

public static FastJson getJson() {
  return new FastJson();
}
 
origin: com.jfinal/jfinal

public Json getJson() {
  return new FastJson();
}
 
com.jfinal.jsonFastJson

Javadoc

Json 转换 fastjson 实现.

Most used methods

  • parse
  • getJson
  • <init>
  • getDefaultDatePattern
  • toJson

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • putExtra (Intent)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • JCheckBox (javax.swing)
  • JTextField (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now