oddity using newtonsoft json.net with powershell

Question:

I have

then do

I get

however

works fine. Also

works but

fails

The latter can be made to work by doing

Which all seems very odd

powershell v2 on windows 7, json.net 4.4.5

Answer:

The self referencing loop issue sems to be all about…. the order in which you assign things. The below example works:

If you convert the type before you pass it in then it will keep your foo3 function generic:

Source:

oddity using newtonsoft json.net with powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply