Time after time I need to merge two large JSON files, or more precisely add a json fragment to another file.

The too pieces are often written by different people and have different formatting (spacing), so margining them mechanically result in an ugly code with ragtag spacing, and formatting one of them manually or semi-manually takes a lot of time and effort.

How I can reformat the fragment in the same style the first file is formatted. I do not know what IDE, formatter, or style guide was used

I know that I can use automated tool to reformat the whole document into whatever is supported, but prefer to keep the original style.

I have heard that coding style can be imitated e.g. in the context of adversary authorship recognition by AI and imagine that for simple cases such as JSON that should be easy. I am interested in merely spacing, indentation, brackets placing, not, say property naming or nesting convention (not sure of ordering, probably not so interesting).

I am software developer trying to automate my tasks, rather than AI researcher, so please be patient.

I posted to stackoverflow, yet the task might be to challenging and open ended for traditional programming methods https://stackoverflow.com/questions/68396829

  • $\begingroup$ Hello. You say "I have heard that coding style can be imitated by AI". In case you still remember where you read this (if you read this), it may be a good idea to provide the link to the reference. $\endgroup$
    – nbro
    Commented Jul 16, 2021 at 12:27
  • $\begingroup$ I cannot remember but added the first reference I was able to google $\endgroup$
    – Serge
    Commented Jul 16, 2021 at 14:16


You must log in to answer this question.

Browse other questions tagged .