import javax.script.ScriptEngine
import javax.script.ScriptEngineManager
import javax.script.ScriptException
import sun.org.mozilla.javascript.internal.ScriptableObject
public class YuGiOh
{
public static void main ( String[] args ) throws ScriptException
{
ScriptEngineManager sem = new ScriptEngineManager ()
ScriptEngine se = sem.getEngineByName ("js")
ScriptableObject obj = (ScriptableObject) se.eval ("({\"code\":100000,\"text\":\"石家庄:05/07 周四,14-24° 21° 晴转多云 北风3-4 级05/08 周五,14-23° 多云 北风3-4 级05/09 周六,13-18° 阴 东北风3-4 级05/10 周日,13-20° 中雨 南风3-4 级\"})")
System.out.println (obj.get ("code", null))
System.out.println (obj.get ("text", null))
}
}
package demoimport javax.script.ScriptEngine
import javax.script.ScriptEngineManager
import javax.script.ScriptException
import sun.org.mozilla.javascript.internal.IdScriptableObject
import sun.org.mozilla.javascript.internal.ScriptableObject
public class YuGiOh
{
public static void main ( String[] args ) throws ScriptException
{
ScriptEngineManager sem = new ScriptEngineManager ()
ScriptEngine se = sem.getEngineByName ("js")
ScriptableObject obj = (ScriptableObject) se.eval ("({\"department\":[{\"organId\":\"99\",\"name\":\"张三\",},{\"organId\":\"53\",\"name\":\"李四\"}],\"resultCode\":\"00\",\"resultMsg\":\"执行成功\"})")
ScriptableObject department = (ScriptableObject) obj.get ("department", null)
Object[] ids = ( (IdScriptableObject) ( department ) ).getIds ()
for ( int i = 0 i < ids.length i++ )
{
IdScriptableObject io = (IdScriptableObject) ( department )
IdScriptableObject object = (IdScriptableObject) io.get (i, null)
System.out.println (object.get ("organId", null))
}
}
}
import javax.script.ScriptEngine
import javax.script.ScriptEngineManager
import javax.script.ScriptException
import sun.org.mozilla.javascript.internal.IdScriptableObject
import sun.org.mozilla.javascript.internal.ScriptableObject
public class YuGiOh
{
public static void main ( String[] args ) throws ScriptException
{
ScriptEngineManager sem = new ScriptEngineManager ()
ScriptEngine se = sem.getEngineByName ("js")
ScriptableObject obj =
(ScriptableObject) se
.eval ("({ \"status\":0, \"transNo\":\"black_1438771928689_kk0Evb\", \"page\": {\"list\": [{\"idCard\":\"37028419760428335X\",\"name\":\"万修明\",\"softName\":\"bus\"}, {\"idCard\":\"370284198609092418\",\"name\":\"丁伟\",\"softName\":\"bus\"}], \"totalPageCount\":632} })")
ScriptableObject list = (ScriptableObject) ( (ScriptableObject) obj.get ("page", null) ).get ("list", null)
Object[] ids = ( (IdScriptableObject) ( list ) ).getIds ()
for ( int i = 0 i < ids.length i++ )
{
IdScriptableObject io = (IdScriptableObject) ( list )
IdScriptableObject object = (IdScriptableObject) io.get (i, null)
System.out.println (object.get ("idCard", null))
}
}
}
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)