anchor.diff:  		       end,
   		       [Result|Seen]}
                     catch _:_ ->
  -                          {EncAcc, NSAcc, TagAcc, Seen}
  +                          {EncAcc, EncJSONAcc, NSAcc, TagAcc, Seen}
                     end
  -          end, {[], [], [], []}, TaggedSpecs),
  +          end, {[], [], [], [], []}, TaggedSpecs),
       if EncClauses /= [] ->
   	    [erl_syntax:function(?AST(do_encode), EncClauses)];
  +       true -> []
  +    end ++
  +    if EncJSONClauses /= [] ->
  +	    [erl_syntax:function(?AST(do_encode_json), EncJSONClauses)];
          true -> []
       end ++
       if TagClauses /= [] ->
  
positive.code:         end,
      DecAST = make_elem_dec_fun(Elem, Tag, AllElems, Types,
  			       ModName, PredefRecords, Opts),
      EncAST = make_elem_enc_fun(Elem, Tag, AllElems, ModName),
      DecAST ++ EncAST ++ AttrAST ++ CDataAST.
  
  %% Replace in `Term' every label found in `Labels'
  %% with the corresponding value.
  
negative.code:     Hdr = header(FileName),
      FunDeps = build_fun_deps(FunForms),
      case write_modules(ASTs, ModName, FunDeps, ErlDirName,
  		       FileName, TaggedElems, PredefRecords, Opts) of
          ok ->
  	    case write_resolver(TaggedElems, ModName, ErlDirName, FileName) of
  		ok ->
  