Thanks Gareth. Got the JSON file in using the second option - must be to big to send to console cutting off data. So I made a smaller JSON file - 2 array entries so I could get it working.
I use this to read it in:
var request = require(‘request’);
request.get(‘https://cdn.glitch.com/e11bb4a0-863b-4fbf-b8a9-cfed70b9f814%2FTwoVehicles.json?1529990938888’, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
[
{
“DealerID”: 16424634,
“VIN”: “1FDUF5HT1HEB8888888”,
“StockNumber”: “T9501”,
“Status”: “A”,
“VehicleType”: 0,
“Year”: 2017,
“Make”: “Ford”,
“Model”: “F-550”,
“Trim”: “XL”,
“Body”: “Dump Body”,
“VehicleClass”: “Passenger”,
“VehicleCategory”: “Retail”,
“Mileage”: 142,
“Transmission”: “Automatic”,
“EngineDisplacement”: 6.7,
“EngineSize”: “8 Cylinder”,
“Induction”: “Diesel”,
“DriveTrain”: “”,
“FuelType”: “”,
“FuelEconomyCity”: 0,
“FuelEconomyHighway”: 0,
“FuelEconomyCombined”: 0,
“Doors”: 0,
“OEMColorCodeExterior”: “”,
“OEMColorCodeInterior”: “”,
“OEMColorNameExterior”: “White”,
“OEMColorNameInterior”: “”,
“GenericColorExterior”: “White”,
“GenericColorInterior”: “Gray”,
“InternetPrice”: 0,
“ComparisonPrice”: 0,
“WholeSalePrice”: “”,
“MSRP”: 0,
“InternetSpecial”: “N”,
“OemModelCode”: “”,
“HasWarranty”: “Y”,
“CertificationWarranty”: 191,
“WarrantyMonth”: 0,
“WarrantyMiles”: 0,
“CertificationNumber”: “”,
“ServiceContract”: “N”,
“InServiceDate”: “1/1/1900 0:00”,
“CertificationDate”: “1/1/1900 0:00”,
“DateManufactured”: “8/1/2016 0:00”,
“DateCreated”: “1/16/2017 16:31”,
“DateUpdated”: “5/17/2018 17:21”,
“DateRemoved”: “1/1/1900 0:00”,
“DatePhotosUpdated”: “1/16/2017 16:36”,
“Photos”: 10,
“SuperSizePhotos”: 10,
“AddendumDetails”: “”,
“Options”: “”,
“PurchasePayment”: 0,
“PurchaseDownPayment”: 0,
“PurchaseTerm”: 0,
“PurchaseDisclosure”: “”,
“PurchaseRate”: 0,
“LeasePayment”: 0,
“LeaseDownPayment”: 0,
“LeaseTerm”: 0,
“LeaseDisclosure”: “”,
“LeaseRate”: 0,
“LeaseResidual”: 0,
“Invoice”: 0,
“ACV”: 0,
“Special”: 0,
“Discount”: 0,
“OptionCodes”: “”,
“PackageCodes”: “”
},
{
“DealerID”: 21641255,
“VIN”: “1FDTF4GT7HEB66666”,
“StockNumber”: “T9626”,
“Status”: “A”,
“VehicleType”: 0,
“Year”: 2017,
“Make”: “Ford”,
“Model”: “F-450”,
“Trim”: “XL”,
“Body”: “Cab & Chassis”,
“VehicleClass”: “Passenger”,
“VehicleCategory”: “Retail”,
“Mileage”: 0,
“Transmission”: “Automatic”,
“EngineDisplacement”: 6.7,
“EngineSize”: “8 Cylinder”,
“Induction”: “Turbo Diesel”,
“DriveTrain”: “”,
“FuelType”: “”,
“FuelEconomyCity”: 0,
“FuelEconomyHighway”: 0,
“FuelEconomyCombined”: 0,
“Doors”: 0,
“OEMColorCodeExterior”: “”,
“OEMColorCodeInterior”: “”,
“OEMColorNameExterior”: “White”,
“OEMColorNameInterior”: “”,
“GenericColorExterior”: “White”,
“GenericColorInterior”: “Gray”,
“InternetPrice”: 0,
“ComparisonPrice”: 0,
“WholeSalePrice”: “”,
“MSRP”: 0,
“InternetSpecial”: “N”,
“OemModelCode”: “”,
“HasWarranty”: “Y”,
“CertificationWarranty”: 191,
“WarrantyMonth”: 0,
“WarrantyMiles”: 0,
“CertificationNumber”: “”,
“ServiceContract”: “N”,
“InServiceDate”: “1/1/1900 0:00”,
“CertificationDate”: “1/1/1900 0:00”,
“DateManufactured”: “8/1/2016 0:00”,
“DateCreated”: “1/16/2017 16:31”,
“DateUpdated”: “5/10/2018 17:21”,
“DateRemoved”: “1/1/1900 0:00”,
“DatePhotosUpdated”: “1/16/2017 16:35”,
“Photos”: 10,
“SuperSizePhotos”: 10,
“AddendumDetails”: “”,
“Options”: “”,
“PurchasePayment”: 0,
“PurchaseDownPayment”: 0,
“PurchaseTerm”: 0,
“PurchaseDisclosure”: “”,
“PurchaseRate”: 0,
“LeasePayment”: 0,
“LeaseDownPayment”: 0,
“LeaseTerm”: 0,
“LeaseDisclosure”: “”,
“LeaseRate”: 0,
“LeaseResidual”: 0,
“Invoice”: 0,
“ACV”: 0,
“Special”: 0,
“Discount”: 0,
“OptionCodes”: “”,
“PackageCodes”: “”
}
]
So no matter what I do to access this data it will not return the value. I have tried
body[0].VIN - cannot find it
I have used array handling like this:
for (var i = 0; i < body.length; i++) {
console.log(body[i].VIN);
}
Nothing lets me get to the VIN text. Do I need to do something with BODY first?
I have 2 JSON files I will need to bring in - I need to take the VIN from set of JSON to find entries for that VIN in another JSON file with image links in.
Help is appreciated.