comparison src/luan/modules/BasicLuan.java @ 1802:ca98dee04e08 default tip

add Parsers.json_null
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 21 Apr 2024 21:25:15 -0600
parents 04ac5f2771c8
children
comparison
equal deleted inserted replaced
1801:32e77b071e09 1802:ca98dee04e08
225 if( options instanceof LuanFunction ) 225 if( options instanceof LuanFunction )
226 return new LuanToString(luan,(LuanFunction)options).toString(obj); 226 return new LuanToString(luan,(LuanFunction)options).toString(obj);
227 throw new LuanException("options must be table of function"); 227 throw new LuanException("options must be table of function");
228 } 228 }
229 229
230 public static final Object json_null = new Object();
231
230 public static String json_string(Object obj,LuanTable options) throws LuanException { 232 public static String json_string(Object obj,LuanTable options) throws LuanException {
231 JsonToString jts = new JsonToString(); 233 JsonToString jts = new JsonToString();
232 if( options != null ) { 234 if( options != null ) {
233 options = new LuanTable(options); 235 options = new LuanTable(options);
234 Boolean compressed = Utils.removeBoolean(options,"compressed"); 236 Boolean compressed = Utils.removeBoolean(options,"compressed");
235 if( compressed != null ) 237 if( compressed != null )
236 jts.compressed = compressed; 238 jts.compressed = compressed;
237 Utils.checkEmpty(options); 239 Utils.checkEmpty(options);
238 } 240 }
239 return jts.toString(Luan.toJava(obj)); 241 return jts.toString(Luan.toJava(obj,json_null));
240 } 242 }
241 243
242 public static Object get_local_cloned(Luan luan,Object obj,Object key) { 244 public static Object get_local_cloned(Luan luan,Object obj,Object key) {
243 return luan.getLocalCloned(obj,key); 245 return luan.getLocalCloned(obj,key);
244 } 246 }