Revert "Revert "copy array dirty handling to json, fixes #42""

This reverts commit 07196e6afb7e09af55cab0d4863dac49af99cd9b.
Revert "Revert "better implementation, Fixes #42 again""

This reverts commit 5adb09a8ad908151d9b51c42c50854ac400a2673.
use single line block convention
inline statement logic