Sunday, 15 August 2010

how do i pass python object as argument to C# program -



how do i pass python object as argument to C# program -

i have c# windows application, need pass object created in python script - argument c# programme , vice-verse. so how pass object created python script c# programme parameter.

for this, don't want utilize iron-python. strict requirement utilize object created running c python scripts. python script reads json file , creates object.

my sample json string :

{"?xml":{"@version":"1.0","@encoding":"windows-1252"},"testscript":{"testexperiment":{"test1":{"control":[{"@type":"system.windows.forms.textbox","@name":"description","@formname":"test1","text":null,"visible":"true"},{"@type":"system.windows.forms.textbox","@name":"objective","@formname":"test1","text":null,"visible":"true"},{"@type":"system.windows.forms.textbox","@name":"test1","@formname":"test1","text":null,"visible":"true"}]}}}}

thanks,

if python objects serialized json, think should first utilize json.net bundle parse input strings json objects.

for instance:

jobject obj = jobject.parse(jsonstring);

after that, recommened create c# objects mirror python objects , deserialize them real objects.

for instance:

// json string object product deserializedproduct = jsonconvert.deserializeobject<product>(productjsonstring);

c# python .net object parameter-passing

No comments:

Post a Comment