Get "%p" to print legal json or convert "%p" to json

In reply to avidan_apple:

Hi Avidan,

Dumping JSON would be fairly straightforward using a combination of the SystemVerilog VPI and a C json library. Parsing json and building a data structure that represents it is much more complicated.

I have not seen a request for this before. Usually people want to dump a large amounts of data from a simulation and json is not very efficient. It does not handle 4-state values or bit widths/ranges, so you might have to dump all values as a string.

The %p format is for dumping values as a SystemVerilog assignment pattern. We cannot change this and would have to add something else to the language to make this happen.