Added CLI processing. Default JSON format is compact, can optionally enable pretty mode.