Created 02-23-2016 08:05 AM
Hi:
I need to reed this json but i cant print or access to the multilevel field just I can read the fisrt level, look:
for example i need to read "VARIABLE":{"TIPINC-F")
my json
{"NUM-PARTICION-F":"001","NOMBRE-REGLA-F":"SAI_TIP_INC_TRN","FECHA-OPRCN-F":"2015-12-06 00:00:01","COD-NRBE-EN-F":"9998","COD-NRBE-EN-FSC-F":"9998","COD-INTERNO-UO-F":"0001","COD-INTERNO-UO-FSC-F":"0001","COD-CSB-OF-F":"0001","COD-CENT-UO-F":"","ID-INTERNO-TERM-TN-F":"A0299989","ID-INTERNO-EMPL-EP-F":"99999989","CANAL":"01","NUM-SEC-F":"764","COD-TX-F":"SAI01COU","COD-TX-DI-F":"TUX","ID-EMPL-AUT-F":"U028765","FECHA-CTBLE-F":"2015-12-07","COD-IDENTIFICACION-F":"","IDENTIFICACION-F":"","VALOR-IMP-F":"0.00","VARIABLE":{"TIPINC-F":"0","PERFIL-CAJ-F":"0","PERFIL-COM-F":"0","PERFIL-TAR-F":"0","RESPONSABLE-F":"0","RESP-EXCEP-F":"0","EXCEPCION-F":"0","STD-CHAR-01-F":"1","STD-DEC-1-F":"0","STD-DEC-2-F":"0"} }
my code:
A = LOAD '/RSI/staging/input/logs/log.json' USING com.twitter.elephantbird.pig.load.JsonLoader('-nestedLoad'); B = FOREACH A GENERATE (CHARARRAY) $0#'FECHA-OPRCN-F' AS fecha, (CHARARRAY) $0#'COD-NRBE-EN-F' AS entidad, (CHARARRAY) $0#'COD-INTERNO-UO-FSC-F' AS ofi , (CHARARRAY) $0#'COD-TX-F' AS ope;
my output
(2015-12-06 00:06:40,9998,0001,DVI82OOU,) (2015-12-06 00:06:42,9998,0001,DVI95COU,) (2015-12-06 00:06:49,3191,9204,BDPPM1ZJ,) (2015-12-06 00:06:49,3076,9554,STR03CON,) (2015-12-06 00:06:53,3008,9521,BDPPM1RJ,)
Created 02-23-2016 09:41 AM
Created 02-23-2016 09:41 AM
Created 02-23-2016 09:46 AM
Hi:
Thanks for the information, finally, i used this:
$0#'VARIABLE'#'IMP-NOMINAL-F'
Many thanks