E
elfenliedtopfan2
Guest
I have a file I got from a site that lists all textures and all names. I want to parse the JSON file and get just the name and texture parts get the url property and download the link with the name above.
I'm not sure how to get this because the whole file is large but I just want to get the url and the width and height. If they are 2048 or 4042. If they match get the name and download the URL and give the name value to the name of download.
So in summary
"name": "Metal_2_roughness.jpg",
"images": [
{
"height": 2048,
"createdAt": "2017-08-11T16:14:06.933292",
"updatedAt": "2017-08-11T16:14:06.933307",
"uid": "ae19ea6db7074248ac4e04b4db971913",
"width": 2048,
"options": {},
"url": "https://media.sketchfab.com/urls/cb...be35565/ae19ea6db7074248ac4e04b4db971913.jpeg",
"size": 1042057
},
If the height and width matches 2048 then check the name. Copy that then copy url and download the URL and give it the name property. But I'm not sure how to go about doing this as I never touched on JSON before.
md_5 paste
this is the full file
full json file
the rest of the json file is not importent all i need name hight with to match 2048 x 2048 if it does then download the url thats under it as shown above example code but as you can tell i by the full json file the file is huge and to parse it is not working well i keep getting
errors like this
Newtonsoft.Json.JsonSerializationException
HResult=0x80131500
Message=Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Drawing.Image' because the type requires a JSON string value to deserialize correctly.
To fix this error either change the JSON to a JSON string value or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path '['/i/models/5c62d2818a404977a6a38057c487a1ed']', line 2, position 53.
Source=Newtonsoft.Json
StackTrace:
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at sf_downloader.Form1.parsetest() in C:\Users\elfenliedtopfan5\source\repos\sf_downloader\Form1.cs:line 109
at sf_downloader.Form1.SimpleButton2_Click(Object sender, EventArgs e) in C:\Users\elfenliedtopfan5\source\repos\sf_downloader\Form1.cs:line 99
at System.Windows.Forms.Control.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
at DevExpress.XtraEditors.BaseControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at sf_downloader.Program.Main() in C:\Users\elfenliedtopfan5\source\repos\sf_downloader\Program.cs:line 19
any help would be much appeicated thanks in advance elfenliedtopfan5
Continue reading...
I'm not sure how to get this because the whole file is large but I just want to get the url and the width and height. If they are 2048 or 4042. If they match get the name and download the URL and give the name value to the name of download.
So in summary
"name": "Metal_2_roughness.jpg",
"images": [
{
"height": 2048,
"createdAt": "2017-08-11T16:14:06.933292",
"updatedAt": "2017-08-11T16:14:06.933307",
"uid": "ae19ea6db7074248ac4e04b4db971913",
"width": 2048,
"options": {},
"url": "https://media.sketchfab.com/urls/cb...be35565/ae19ea6db7074248ac4e04b4db971913.jpeg",
"size": 1042057
},
If the height and width matches 2048 then check the name. Copy that then copy url and download the URL and give it the name property. But I'm not sure how to go about doing this as I never touched on JSON before.
md_5 paste
this is the full file
full json file
the rest of the json file is not importent all i need name hight with to match 2048 x 2048 if it does then download the url thats under it as shown above example code but as you can tell i by the full json file the file is huge and to parse it is not working well i keep getting
errors like this
Newtonsoft.Json.JsonSerializationException
HResult=0x80131500
Message=Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Drawing.Image' because the type requires a JSON string value to deserialize correctly.
To fix this error either change the JSON to a JSON string value or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path '['/i/models/5c62d2818a404977a6a38057c487a1ed']', line 2, position 53.
Source=Newtonsoft.Json
StackTrace:
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at sf_downloader.Form1.parsetest() in C:\Users\elfenliedtopfan5\source\repos\sf_downloader\Form1.cs:line 109
at sf_downloader.Form1.SimpleButton2_Click(Object sender, EventArgs e) in C:\Users\elfenliedtopfan5\source\repos\sf_downloader\Form1.cs:line 99
at System.Windows.Forms.Control.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
at DevExpress.XtraEditors.BaseControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at sf_downloader.Program.Main() in C:\Users\elfenliedtopfan5\source\repos\sf_downloader\Program.cs:line 19
any help would be much appeicated thanks in advance elfenliedtopfan5
Continue reading...