How I can deserialize python pickles in C#?

c#, pickle, python

Solution

You say you can't change the program that generates the pickle. But surely you can write a separate Python program to read the pickle and write it out again as JSON?

import json, pickle

with open("data.pickle", "rb") as fpick:
    with open("data.json", "w") as fjson:
        json.dump(pickle.load(fpick), fjson)

Problem

I have some python data, serialized to pickles and need to use it in C# program. So is there any way to deserialize python pickles in C#? I can't change data format to JSON or etc.

Original source